2013-12-17 69 views
-1

我遇到了一個問題,那就是殺了我,請幫我。laravel 4線路上存在的那條線路不存在route.php

我在laravel 4的一個項目中工作時,我忘記了routes.php中的分號,屏幕錯誤laravel警告過我,但添加分號後錯誤仍然存​​在,所以我刪除了'整個代碼塊錯誤,但拉拉維爾仍然給了我一個錯誤,不再存在那條線。所以我刪除了文件routes.php,但是laravel仍然給了我同樣的錯誤,現在我已經放回了routes.php,但這些視圖給了我奇怪的結果,而且我仍然得到關於缺少分號的錯誤。

我爲我錯誤的英語道歉。 非常感謝。

編輯:好吧,我很抱歉..但我不知道該寫什麼代碼,因爲這個錯誤就是這麼奇怪

的錯誤是: 的Symfony \分量\調試\異常\ FatalErrorException ... /應用程序/ routes.php116

語法錯誤,意想不到的T_FOREACH

Route::post('/realtime_callback', function() 
{ 

    $post = Input::all(); 
    $a = print_r($myString, true); 
    file_put_contents('activity.log', "\r\n".$myString[0]["subscription_id"], FILE_APPEND) 
    /*line 116*/foreach($myString[0]['data'] as $item) 
     file_put_contents('text.log', "\r\naa".$item, FILE_APPEND); 

但actuale代碼:

Route::post('/realtime_callback', function() { 

$post = Input::all(); 

/*line 116*/$evento = Evento::where('subscription_id', '=', $post[0]["subscription_id"]); 

$search = new SearchTag($evento->tag); 

$response = json_decode($search->sendRequest($evento->min_id)); 

foreach($response->data as $item) { 

    $photo_exist = Photo::where('id', '=', $item->id); 

    if(is_null($photo_exist)) 
     $photo = new Photo(); 
     $photo->id = $item->id; 
     $photo->eve_cod = $evento->name; 
     $photo->save(); 
} 

Evento::where('name', '=', $event_name)->update(array('min_id' => $response->pagination->min_tag_id)); 
}); 

奇怪的結果意味着從previus視圖顯示不同的結果,幾乎所有的網頁給我回404頁,OLSE對應於

Route::get('/', function(){ 

//return Redirect::to('users/register'); 
return "hello"; 
}); 
+0

我們需要更多的細節..請寫下你得到的錯誤+給我們看一些代碼...並檢查你是否使用了像apc或opCache這樣的緩存 –

+0

請發佈錯誤和你的routes.php – msturdy

+0

我有添加更多信息,非常感謝 – Antonio

回答

2

在此代碼塊/

Route::post('/realtime_callback', function() 
{ 
    $post = Input::all(); 
    $a = print_r($myString, true); 
    // This line is missing the semicolon at the end 
    file_put_contents('activity.log', "\r\n".$myString[0]["subscription_id"], FILE_APPEND) 
    /*line 116*/foreach($myString[0]['data'] as $item) 
    file_put_contents('text.log', "\r\naa".$item, FILE_APPEND); 

你錯過了一行分號,其中file_put_contents,就在foreach行之前。