« PHP 8.3 Manual トップ
著作権 »
per page, with , order by , clip by
Results of 1 - 10 of about 31 for argv (0.002 sec.)
$argv — スクリプトに渡された引数の配列 | PHP 8.3 14414
$argv (PHP 4, PHP 5, PHP 7, PHP 8) $argv — スクリプトに渡された引数の配列 説明 コマンドライン から実行したときに、 現在のスクリプトに渡されたすべての引数の配列が含まれます。 注意 : 最初の引数 $argv[0] は常に、スクリプトの実行に使う名前となり ... ます。 注意 : この変数は、 register_argc_argv が無効になっている場合には使えません。 警告 スクリプトがコマンドラインから実行されているかどうかを確認するには、 $argv や ... $_SERVER['argv'] が設定されているかを確認するのではなく、 php_sapi_name() を使うべきです。 例 例1 $argv の例 <?php var_dump ( $argv ); ?> ... ing(10) "script.php" [1]=> string(4) "arg1" [2]=> string(4) "arg2" [3]=> string(4) "arg3" } 注意 注意 : これは、 $_SERVER['argv'] としても使用可能です。 参考 getopt() - コマンドライン引数のリストからオプションを取得する $argc 他のマニュアルの関連ペー ...
https://man.mtool.work/php/8.3/reserved.variables.argv.html
PHP ファイルの実行 | PHP 8.3 10580
PHP ファイルの実行 CLI SAPI は、実行する PHP コードを 取得するために三種類の異なる手段をサポートしています。 PHP に特定のファイルの実行を指示する。 $ php my_script.php $ php -f my_script.php 上記の方法は共に( -f スイッチの使用の如何に関らず ... 能な文字数の最大値を設定しています。通常、この制限値を 越えることはできません)。スクリプトに指定した引数は、グローバル配列 $argv でアクセス可能です。 最初のインデックス (添字 0) には常に、 コマンドラインからコールしたスクリプト名が含まれています。 コマ ... ンドラインスイッチ -r を使ってインラインでコードを実行した場合は、 $argv[0] の値は "Standard input code" となることに注意しましょう。 PHP 7.2.0 より前のバージョンでは、 ダッシュ ( - ) でした。 ST ... 経由で実行した場合も同じです。 登録される第 2 のグローバル変数は $argc で (スクリプトに指定された引数の数では なく )、配列 $argv の要素数が含まれます。 スクリプトに指定する引数が文字 - で始まっていない 限り、特に留意すべきことはありません。スクリプトに ...
https://man.mtool.work/php/8.3/features.commandline.usage.html
他の SAPI との違い | PHP 8.3 10337
他の SAPI との違い CLI SAPI を他の SAPI と比べた時の 大きな違いを以下に示します。 CGI SAPI と異なり、ヘッダが出力されません。 CGI SAPI は HTTP ヘッダの出力を抑制する機能を 提供していますが、等価な機能は CLI SAPI ではサポートされていません。 ... で実行されるよう作られて いますが、シェルアプリケーションの実行時間は、これよりかなり 長くなる傾向があります。 register_argc_argv true この設定が true なので、 CLI SAPI では常に argc (アプリケーションに渡した引数の数) および argv (実際の引数の配列) を使 ... うことができます。 CLI SAPI を使用するときに PHP の $argc 変数と $argv 変数が登録され、適切な値がセットされます。 あるいは $_SERVER や $_SERVER['argv'] を使うこともできます。 警告 $argv や $_SE ... RVER['argv'] が存在することは、PHPスクリプトがコマンドラインから実行されていることを示す信頼できる根拠にはなりません。 なぜなら、 reg ...
https://man.mtool.work/php/8.3/features.commandline.differences.html
stream_notification_callback — notification コンテキストパラメータ用のコールバ... 9916
stream_notification_callback (PHP 5 >= 5.2.0, PHP 7, PHP 8) stream_notification_callback — notification コンテキストパラメータ用のコールバック関数 説明 function stream_notification_callback ( int $notification_code , int $severity , ? strin ... rogress, downloaded 7002 so far 例2 コマンドラインのダウンロードツール用のシンプルなプログレスバー <?php function usage ( $argv ) { echo "Usage:\n" ; printf ( "\tphp %s <http://example.com/file> <localfile>\n" , $argv [ 0 ]); exit( 1 ); } function st ... , str_repeat ( "=" , $length ). ">" , $length , ( $bytes_transferred / 1024 ), $filesize / 1024 ); } } break; } } isset( $argv [ 1 ], $argv [ 2 ]) or usage ( $argv ); $ctx = stream_context_create (); stream_context_set_params ( $ctx , array( "notifi ... cation" => "stream_notification_callback" )); $fp = fopen ( $argv [ 1 ], "r" , false , $ctx ); if ( is_resource ( $fp ) && file_put_contents ( $argv [ 2 ], $fp )) { echo "\nDone!\n" ; exit ...
https://man.mtool.work/php/8.3/function.stream-notification-callback.html
parallel\Runtime::run — Execution | PHP 8.3 9674
parallel\Runtime::run (0.8.0) parallel\Runtime::run — Execution 説明 public function parallel\Runtime::run ( Closure $task ): ? Future Shall schedule task for execution in parallel. public function parallel\Runtime::run ( Closure $task , ar ... ray $argv ): ? Future Shall schedule task for execution in parallel, passing argv at execution time. パラメータ task A Closure with ... specific characteristics. argv An array of arguments with specific characteristics to be passed to task at execution time. Task Characteristics Closures ... ruction if task contains illegal instructions. 警告 Shall throw parallel\Runtime\Error\IllegalParameter if task accepts or argv contains illegal variables. 警告 Shall throw parallel\Runtime\Error\IllegalReturn if task returns illegally. 他のマニュアル ...
https://man.mtool.work/php/8.3/parallel-runtime.run.html
parallel\run — Execution | PHP 8.3 9496
parallel\run (1.0.0) parallel\run — Execution 説明 function parallel\run ( Closure $task ): ? Future Shall schedule task for execution in parallel. function parallel\run ( Closure $task , array $argv ): ? Future Shall schedule task for exec ... ution in parallel, passing argv at execution time. Automatic Scheduling If a \parallel\Runtime internally created and cached by a previous call to paralle ... created by the programmer are not used for automatic scheduling. パラメータ task A Closure with specific characteristics. argv An array of arguments with specific characteristics to be passed to task at execution time. Task Characteristics Closures ... ruction if task contains illegal instructions. 警告 Shall throw parallel\Runtime\Error\IllegalParameter if task accepts or argv contains illegal variables. 警告 Shall throw parallel\Runtime\Error\IllegalReturn if task returns illegally. 参考 parallel ...
https://man.mtool.work/php/8.3/parallel.run.html
例 | PHP 8.3 9091
例 例1 Simple HTTP client <?php // Read callback function readcb ( $bev , $base ) { //$input = $bev->input; //$bev->getInput(); //$pos = $input->search("TTP"); $pos = $bev -> input -> search ( "TTP" ); while (( $n = $bev -> input -> remove ... losing\n" ; $base -> exit (); exit( "Done\n" ); } } if ( $argc != 3 ) { echo <<<EOS Trivial HTTP 0.x client Syntax: php { $argv [ 0 ]} [hostname] [resource] Example: php { $argv [ 0 ]} www.google.com / EOS; exit(); } $base = new EventBase (); $dns_ba ... enable ( Event :: READ | Event :: WRITE ); $output = $bev -> output ; //$bev->getOutput(); if (! $output -> add ( "GET { $argv [ 2 ]} HTTP/1.0\r\n" . "Host: { $argv [ 1 ]} \r\n" . "Connection: Close\r\n\r\n" )) { exit( "Failed adding request to outp ... ut buffer\n" ); } if (! $bev -> connectHost ( $dns_base , $argv [ 1 ], 80 , EventUtil :: AF_UNSPEC )) { exit( "Can't connect to host { $argv [ 1 ]} \n" ); } $base -> dispatch (); ?> 上の ...
https://man.mtool.work/php/8.3/event.examples.html
EventBufferEvent::connectHost — Connects to a hostname with optionally asynchro... 8832
EventBufferEvent::connectHost (PECL event >= 1.2.6-beta) EventBufferEvent::connectHost — Connects to a hostname with optionally asynchronous DNS resolving 説明 public function EventBufferEvent::connectHost ( EventDnsBase $dns_base , string ... enable ( Event :: READ | Event :: WRITE ); $output = $bev -> output ; //$bev->getOutput(); if (! $output -> add ( "GET { $argv [ 2 ]} HTTP/1.0\r\n" . "Host: { $argv [ 1 ]} \r\n" . "Connection: Close\r\n\r\n" )) { exit( "Failed adding request to outp ... ut buffer\n" ); } if (! $bev -> connectHost ( $dns_base , $argv [ 1 ], 80 , EventUtil :: AF_UNSPEC )) { exit( "Can't connect to host { $argv [ 1 ]} \n" ); } $base -> dispatch (); ?> 上の ...
https://man.mtool.work/php/8.3/eventbufferevent.connecthost.html
Yaf_Application::execute — コールバックを実行する | PHP 8.3 8412
Yaf_Application::execute (Yaf >=1.0.0) Yaf_Application::execute — コールバックを実行する 説明 public function Yaf_Application::execute ( callable $entry , string ...$args ): void このメソッドは一般的に、Yaf_Application を crontab で実行させ ... ルバック。 args コールバックに渡すパラメータ。 戻り値 例 例1 Yaf_Application::execute() の例 <?php function main ( $argc , $argv ) { } $config = array( "application" => array( "directory" => realpath ( dirname ( __FILE__ )) . "/application" , ), ); /* ... * Yaf_Application */ $application = new Yaf_Application ( $config ); $application -> execute ( "main" , $argc , $argv ); ?> 上の例の出力は、 たとえば以下のようになります。 他のマニュアルの関連ページ Linux JM crontab(1) Linux JM crontab(5) L ...
https://man.mtool.work/php/8.3/yaf-application.execute.html
EventBufferEvent::getOutput — Returns underlying output buffer associated with ... 8331
EventBufferEvent::getOutput (PECL event >= 1.2.6-beta) EventBufferEvent::getOutput — Returns underlying output buffer associated with current buffer event 説明 public function EventBufferEvent::getOutput (): EventBuffer Returns underlying o ... \n" ); } $bev -> enable ( Event :: READ | Event :: WRITE ); $output = $bev -> getOutput (); if (! $output -> add ( "GET { $argv [ 2 ]} HTTP/1.0\r\n" . "Host: { $argv [ 1 ]} \r\n" . "Connection: Close\r\n\r\n" )) { exit( "Failed adding request to outp ...
https://man.mtool.work/php/8.3/eventbufferevent.getoutput.html
PREV 1 2 3 4 NEXT