-1
routes.php文件如何在Laravel 5.2中從URL獲得價值?
use Illuminate\Http\Request;
Route::get('/age/{val}','[email protected]');
AgeController.php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
class AgeController extends Controller
{
//
public function store(Request $request)
{
$data = $request->input('val');
var_dump($data);
}
}
我的網址是localhost/lara/public/age/20
。
但
output:array(0) { }
當我改變$request->input('val',500);
然後輸出:int(500)
如何獲得20(VAL)的控制器?爲什麼數組爲空?