考虑以下示例:
Route::group(['domain' => 'something.example.local'], function() {
Route::get('scripts', 'SomethingController@scripts');
});
现在让我们假设您已打开something.example.local/scripts
并且您将鼠标悬停在这样的链接上:<a href="{{ url(/scripts) }}">hello world</a>
您将看到something.example.local/scripts
. 伟大的。
不example.local
去做同样的事情:example.local/scripts
....那是错误的。应该说:something.example.local/scripts
。
您如何使用 laravel 辅助方法来获取适当且完整的 url、域和所有内容?