我可以看到,当资源名称包含加号(+)时,Laravel无法获取资源
Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException
GET http://localhost:8000/vendor/store/store+json2.min.js 404 (Not Found)
GET http://localhost:8000/vendor/animo/animate+animo.css 404 (Not Found)
REQUEST_URI /vendor/store/store+json2.min.js
REQUEST_METHOD GET
SCRIPT_NAME /vendor/store/store json2.min.js
REQUEST_URI /vendor/animo/animate+animo.css
REQUEST_METHOD GET
SCRIPT_NAME /vendor/animo/animate animo.css
我可以通过删除加号来更改文件名来解决这个问题。但有没有办法在不改变文件名的情况下做到这一点?
我正在使用Laravel 4。*
以下是路径文件中的内容:
Route::get('/', function()
{
return View::make('hello');
});
// Confide routes
Route::get('users/create', 'UsersController@create');
Route::get('users/create/{plan}', 'UsersController@create');
Route::post('users', 'UsersController@store');
Route::get('users/login', 'UsersController@login');
Route::post('users/login', 'UsersController@doLogin');
Route::get('users/confirm/{code}', 'UsersController@confirm');
Route::get('users/forgot_password', 'UsersController@forgotPassword');
Route::post('users/forgot_password', 'UsersController@doForgotPassword');
Route::get('users/reset_password/{token}', 'UsersController@resetPassword');
Route::post('users/reset_password', 'UsersController@doResetPassword');
Route::get('users/logout', 'UsersController@logout');
Route::resource('categories', 'CategoriesController');
Route::resource('forms', 'FormsController');
Route::resource('submissions', 'SubmissionsController');
答案 0 :(得分:0)
实际问题是由于某种原因导致两个重写条件:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
您的请求无法正常使用。他们应该防止文件请求被代理到Laravel。它似乎也与环境有关。 (在我的本地服务器上,它工作得很好)
显然有效的解决方法是使用网址编码值+
替换%2B
或者只使用urlencode():
urlencode('http://localhost:8000/vendor/store/store+json2.min.js')