webman 為何在centos 使用 wget或者curl 訪問 卻獲取不到$_GET請(qǐng)求參數(shù)呢,用PHP中的 curl或者file之類的訪問都不行。
同樣的URL 直接使用瀏覽器訪問就可以正常獲取
研究一晚上了,請(qǐng)各位幫忙看看是不是也有這種情況。
下面的代碼很明顯,只打印了第一個(gè)參數(shù),也只獲取到了第一個(gè)。
curl http://127.0.0.1:8000/api/index?ddfads=32432&fdsfds=43254324&fhewfhew=345324324hh4hj32j32h4j32h4j32h4h32hr3jhfd&dsfjdsjfjdssfjdskfk=34333
[1] 1441075
[2] 1441076
[3] 1441077
[root@server yunpolice]# test{"ddfads":"32432"}
[1] 已完成 curl http://127.0.0.1:8000/api/index?ddfads=32432
[2]- 已完成 fdsfds=43254324
[3]+ 已完成 fhewfhew=345324324hh4hj32j32h4j32h4j32h4h32hr3jhfd
<?php
namespace app\controller;
use support\Request;
use support\Db;
use support\TtsVoiceSender;
use support\singleCallByTts;
use support\yuncall;
class ApiController
{
public function index(Request $request)
{
static $readme;
if (!$readme) {
$readme = "test".json_encode($request->get());
}
return $readme;
}
}
最新版本webman php8.2以上
完全參考
http://m.wtbis.cn/doc/webman/request.html
基礎(chǔ)請(qǐng)求寫的,沒有增加任何其他的設(shè)置
就是打算做一個(gè)API服務(wù)而已/
命令行中包含 &
會(huì)被解釋為命令的分隔符。你需要用引號(hào)將整個(gè) URL 包裹起來,或者轉(zhuǎn)義 &
符號(hào)。
可以嘗試以下方法:
curl "http://127.0.0.1:8000/api/index?ddfads=32432&fdsfds=43254324&fhewfhew=345324324hh4hj32j32h4j32h4j32h4h32hr3jhfd&dsfjdsjfjdssfjdskfk=34333"
&
curl http://127.0.0.1:8000/api/index?ddfads=32432\&fdsfds=43254324\&fhewfhew=345324324hh4hj32j32h4j32h4j32h4h32hr3jhfd\&dsfjdsjfjdssfjdskfk=34333
這樣可以確保所有參數(shù)被正確傳遞到服務(wù)器。
問下AI就知道了 http://m.wtbis.cn/ai