-1

我有一个问题正在杀死我,请帮助我。

当我在 routes.php 中忘记分号时,我在 laravel 4 中进行了一个项目,屏幕错误 laravel 警告我,但添加分号后错误仍然存​​在,所以我删除了带有错误的整个代码块,但是laravel 仍然在该行上给了我一个不再存在的错误。所以我删除了文件 routes.php,但 laravel 仍然给了我同样的错误,现在我放回了 routes.php 但视图给了我奇怪的结果,我仍然得到关于缺少分号的错误。

我为我错误的英语道歉。非常感谢。

编辑:好的,对不起..但我不知道要写什么代码,因为这个错误太奇怪了

错误是: Symfony\Component\Debug\Exception\FatalErrorException …/app/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);

但实际代码是:

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));
});

奇怪的结果意味着视图显示的结果与以前不同,几乎所有页面都将我带回到 404 页,否则 / 对应于

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

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

1 回答 1

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);

您错过了 where 行中的分号file_put_contents,就在该foreach行之前。

于 2013-12-17T17:19:41.507 回答