Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Laravel 5奇怪的URL路由_Url_Routing_Laravel 5 - Fatal编程技术网

Laravel 5奇怪的URL路由

Laravel 5奇怪的URL路由,url,routing,laravel-5,Url,Routing,Laravel 5,我正在从事一个Laravel5项目,我正在使用一些ajax调用。但奇怪的事情正在发生。我有这个错误404未找到 http://localhost/qms/public/crm/api/questions/childcount?colheader=guidedogs_001 这是一个ajax调用。我的路线是 Route::get('api/questions/childcount', 'QuestionController@apiQuestionChildCount'); 现在,我知道错误页面

我正在从事一个Laravel5项目,我正在使用一些ajax调用。但奇怪的事情正在发生。我有这个错误<代码>404未找到

http://localhost/qms/public/crm/api/questions/childcount?colheader=guidedogs_001
这是一个ajax调用。我的路线是

Route::get('api/questions/childcount', 'QuestionController@apiQuestionChildCount');
现在,我知道错误页面中的url在
public
之后附加了
crm
,所以现在我将更新我的路线到

Route::get('crm/api/questions/childcount', 'QuestionController@apiQuestionChildCount');
然后,当我再次尝试时,我仍然发现
404notfound
错误,url为

http://localhost/qms/public/crm/crm/api/questions/childcount?colheader=guidedogs_001
它正在附加另一个
crm


有什么问题吗?有时有效,但现在无效。我正在调用页面
http://localhost/qms/public/crm/create

它现在可以工作了,我发现,在我的javascript上它是
api/questions/childcount
,我的路线需要是
crm/api/questions/childcount
。不知道发生了什么。

你是如何在javascript中编写链接的。因为从你的问题来看,我怀疑它在某些页面上有效,但在其他页面上无效。现在,我发现,在我的javascript中,它是api/questions/childcount,我的路径需要是crm/api/questions/childcount。不知道发生了什么事。