W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗值獎勵
如果請求來自命令行調用,則請求對象實際上是 CLIRequest
。它的行為與常規(guī)請求相同, 但為方便起見添加了一些訪問器方法。
getSegments()
返回被視為路徑一部分的命令行參數(shù)數(shù)組:
// command line: php index.php users 21 profile -foo bar
echo $request->getSegments(); // ['users', '21', 'profile']
getPath()
以字符串形式返回重建的路徑:
// command line: php index.php users 21 profile -foo bar
echo $request->getPath(); // users/21/profile
getOptions()
返回被視為選項的命令行參數(shù)數(shù)組:
// command line: php index.php users 21 profile -foo bar
echo $request->getOptions(); // ['foo' => 'bar']
getOption($which)
返回被視為選項的特定命令行參數(shù)的值:
// command line: php index.php users 21 profile -foo bar
echo $request->getOption('foo'); // bar
echo $request->getOption('notthere'); // NULL
getOptionString()
返回選項的重構的命令行字符串:
// command line: php index.php users 21 profile -foo bar
echo $request->getOptionPath(); // -foo bar
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: