企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持知识库和私有化部署方案 广告
变量类型方法包括: 方法 |描述 | ------------|-----------------------------------| get |获取 $_GET 变量 | post |获取 $_POST 变量 | put |获取 PUT 变量 | `变量获取`可使用以下方法: **GET方法一:** ```php <?php namespace app\index; use maiji\Action; class Index extends Action { public function index($id){ dump($id); } } ``` 访问http://www.wpa.com/index/index/index-1-5-9 输出 ``` array(3) { [0]=> string(1) "1" [1]=> string(1) "5" [2]=> string(1) "9" } ``` **GET方法二:** ```php public function index() { $id = $_GET['name']; dump($id); } ``` 访问 http://www.wpa.com/index/index/index?name=c32 输出` string(3) "c32"` **GET方法三:** ```php public function index() { dump(GET()); } ``` 访问http://www.wpa.com/index/index/index?a=1&b=2&c=3 输出 ``` array(3) { ["a"]=> string(1) "1" ["b"]=> string(1) "2" ["c"]=> string(1) "3" } dump(GET('c')); 输出 string(1) "3" ``` POST方法同上,支持 `$_POST['name']` 以及 `POST()` >#### 使用原生$_POST不会过滤相关特殊符号