Skip to content

Commit

Permalink
=getArgs function add param keys to get specific param
Browse files Browse the repository at this point in the history
  • Loading branch information
郭庆哲 committed Aug 9, 2018
1 parent 61f8b9a commit 43293d8
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Async.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,19 @@ public static function wait(callable $logHandler = null)
* @param null $argv <p>
* Be sure to import $argv[1] to get the parameters of script execution.
* </p>
* @return mixed|null
* @return mixed if key is null or sth can found in params | null if no args input | false If there is no corresponding key here
*/
public static function getArgs($argv = null)
public static function getArgs($argv = null, $key = null)
{
if ($argv == null) {
return null;
}
return json_decode(base64_decode($argv), 1);
$params = json_decode(base64_decode($argv), 1);
if ($key == null) {
return $params;
}
return isset($params[$key]) ? $params[$key] : false;

}

public static function getReturn($return)
Expand Down

0 comments on commit 43293d8

Please sign in to comment.