天天看點

thinkphp5模拟post請求_thinkPHP5.1架構路由::get、post請求簡單用法示例|chu

本文執行個體講述了thinkPHP5.1架構路由::get、post請求簡單用法。分享給大家供大家參考,具體如下:

1、在index子產品下的控制器index裡面建立一個type方法

public function type(){ var_dump(input()); echo '我是測試類型'; return view(); }

2、在index子產品下建立view視圖建立index檔案夾建立type.html頁面

Title

3、設定路由

//Route::rule('type','Index/index/type','get'); Route::get('type','index/index/type');

//Route::rule('type','index/index/type','post'); Route::post('type','index/index/type'); //或者 //Route::rule('type','index/index/type','get|post');

效果圖:

輸入111

thinkphp5模拟post請求_thinkPHP5.1架構路由::get、post請求簡單用法示例|chu

輸出

thinkphp5模拟post請求_thinkPHP5.1架構路由::get、post請求簡單用法示例|chu

希望本文所述對大家基于ThinkPHP架構的PHP程式設計有所幫助。