我在Laravel 5.2中有一個項目,並且有一條路線不起作用的問題。當我把這個路徑它關係到Apache的404Laravel ONE路線不能正常工作
這些都是我的一些路線:
Route::get ('/icons', '[email protected]');
Route::get ('/icons/create', '[email protected]');
Route::post ('/icons', '[email protected]');
Route::get ('/icons/{id}/edit', '[email protected]');
Route::patch ('/icons/{id}', '[email protected]');
Route::delete ('/icons', '[email protected]');
正如你所看到的,這些都是CRUD路線。在我的應用程序中,我有更多類似這樣的路線,但只是'/icons/{id}/edit'
給我錯誤。
我已經嘗試改變路線來調用視圖,但錯誤仍在繼續。
Route::get ('/icons/{id}/edit', function() {
return view('welcome');
});
在我的開發人員機器中,路由起作用,但在生產服務器中不。
開發機:OSX +的Apache + PHP7
生產服務器:Ubuntu的16 +的Apache + PHP7
我應該怎麼做才能解決這些?如果您需要更多信息,請告訴我。謝謝。
編輯:
IconController延伸GeneralController。
在GeneralController我:
public function edit($id, Request $request)
{
$log = new ActivityLogRepository();
$log->store($request, 'R');
$this->request = $request;
$segments = $request->segments();
return view($this->viewDir.'.form', [
'data' => $this->editData($id),
'name' => $this->name,
'icon' => $this->icon,
'nameAction' => trans('messages.button_'.end($segments)),
'baseRoute' => $this->baseRoute,
'viewDir' => $this->viewDir,
]);
}
在IconController我:
所有CRUD控制器的工作方式相同。
編輯2:
Apache日誌。我訪問了圖標頁面,然後訪問了另一個CRUD(客戶端)。
my_ip - - [01/Sep/2017:13:21:40 +0000] "GET/HTTP/1.1" 302 1377 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36"
my_ip - - [01/Sep/2017:13:21:40 +0000] "GET /login HTTP/1.1" 200 2881 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36"
my_ip - - [01/Sep/2017:13:21:55 +0000] "POST /login HTTP/1.1" 302 1347 "http://example.com/login" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36"
my_ip - - [01/Sep/2017:13:21:55 +0000] "GET/HTTP/1.1" 200 11140 "http://example.com/login" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36"
my_ip - - [01/Sep/2017:13:21:56 +0000] "GET /images/users/thumbs/5968097a83fae.png HTTP/1.1" 304 181 "http://example.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36"
my_ip - - [01/Sep/2017:13:21:57 +0000] "GET /events/notification HTTP/1.1" 200 972 "http://example.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36"
my_ip - - [01/Sep/2017:13:22:04 +0000] "GET /icons HTTP/1.1" 200 7285 "http://example.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36"
my_ip - - [01/Sep/2017:13:22:11 +0000] "GET /icons/44/edit HTTP/1.1" 404 510 "http://example.com/icons" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36"
my_ip - - [01/Sep/2017:13:29:18 +0000] "GET /clients HTTP/1.1" 200 6523 "http://example.com/icons" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36"
my_ip - - [01/Sep/2017:13:29:20 +0000] "GET /clients/16/edit HTTP/1.1" 200 12344 "http://example.com/clients" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36"
你可以分享@edit方法嗎?和你的完整路線文件,我會說有相同的命名帖子或放置方法衝突 –
@AnarBayramov我編輯與代碼的問題和[這裏是路線](https://pastebin.com/h1ktspuD) –
你可以顯示apache訪問日誌? –