我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

Laravel 4 - Catch Error异常无效

I have the following code in my controller:

public function edit($id)
{       
    try
    {
        $post = Post::findOrFail($id);

        $this->layout->content = View::make('edit.press');
    }       
    catch(ModelNotFoundException $e)
    {
        return Redirect::to('press');   
    }

}

when I actually go to the page /press/1/edit & id 1 is not in there I get an exception error : ModelNotFoundExceptio , Laravel error pages shows up and its not redirecting to the press page again? why please help me

近期文章

  • PHP MySQLi从索引中的表中选择行
  • 如何从示例中获取页码(使用PHP)
  • 检索数据库wordpress中的序列化值
  • MySql - 在varchar的两个日期之间搜索
  • 将重新排序的数组值发送到api的sanizatied值
  • 你可以为Wordpress主题集成一个内置的图像压缩器吗?
  • 在返回的HTML中上传文件返回HTML标签的iframe方法
  • 在PHP中使用JSON数组
  • 导出Excel Zend Framework
  • 从循环外定义的函数传递变量但在循环内调用
  • 额外的index.php? 在网址中添加
  • php curl登录远程服务器
  • 无法使用ajax将数据发送到我的php
  • 设置多个唯一约束
  • mysql更新php后的空值
  • ImageMagick on MacOS 10.10 Yosemite - dyld错误
  • 如何在php服务器上接收JSON对象
  • 用DB中的select选择用户登录的php [关闭]
  • 从隐藏表中的值创建链接
  • 试图在wordpress中获取非对象错误

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华