Skip to content

Commit 43293d8

Browse files
author
郭庆哲
committed
=getArgs function add param keys to get specific param
1 parent 61f8b9a commit 43293d8

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/Async.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,19 @@ public static function wait(callable $logHandler = null)
120120
* @param null $argv <p>
121121
* Be sure to import $argv[1] to get the parameters of script execution.
122122
* </p>
123-
* @return mixed|null
123+
* @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
124124
*/
125-
public static function getArgs($argv = null)
125+
public static function getArgs($argv = null, $key = null)
126126
{
127127
if ($argv == null) {
128128
return null;
129129
}
130-
return json_decode(base64_decode($argv), 1);
130+
$params = json_decode(base64_decode($argv), 1);
131+
if ($key == null) {
132+
return $params;
133+
}
134+
return isset($params[$key]) ? $params[$key] : false;
135+
131136
}
132137

133138
public static function getReturn($return)

0 commit comments

Comments
 (0)