我还是 Laravel 的新手。
我遇到了一个问题,如何使用 isset($_GET)
?
例如,如何获取: http://virtualhost.com/flytrap/public/location?city=25?
通常在纯 PHP 中,我总是使用:
if (isset($_GET["submit"]))
{
$location = $_GET["city"];
}
获取城市值。这样我就可以在数据库查询中使用它。如果我使用Core PHP方法,就会出错。
我还是 Laravel 的新手。
我遇到了一个问题,如何使用 isset($_GET)
?
例如,如何获取: http://virtualhost.com/flytrap/public/location?city=25?
通常在纯 PHP 中,我总是使用:
if (isset($_GET["submit"]))
{
$location = $_GET["city"];
}
获取城市值。这样我就可以在数据库查询中使用它。如果我使用Core PHP方法,就会出错。
$location = Request::query('city', false); //insed of $_GET['city'];
if (Input::has('submit')) {
$location = Input::get('city');
}
$location = Input::get('city', null);
$location = Input::get('city', 'Reykjavik');