php - 使用 yii 框架切换到生产环境时出现 404

标签 php yii http-status-code-404 production-environment

我使用yii框架进行开发,开发时一切正常。

今天早上我添加了一条新路由并将其推送到服务器,但我无法访问它,我收到了 404 页面未找到。我尝试更改访问规则以使其可供每个人访问,但没有任何变化,仍然是 404。 我正在尝试通过以下网址访问更新方法:index.php?r=adminuser/update&id=5

这是 Controller 的代码:

class AdminUserController extends Controller {

  public function filters()
  {
    return array(
        'accessControl', // perform access control for CRUD operations
    );
  }

  public function accessRules()
  {
    return array(
        array('allow', 
            'actions' => array('index', 'create', 'update'),
            'users'   => array('@'),
        ),
        array('allow', 
            'actions' => array('admin', 'delete'),
            'roles'   => array('admin'),
        ),
        array('deny', // deny all users
            'users' => array('*'),
        ),
    );
  }
  public function actionUpdate($id)
  {
   $model=$this->loadModel($id);

   if(isset($_POST['AdminUser']))
     $model->save($_POST['AdminUser'])
   $this->render('update',array(
        'model'=>$model,
    ));
  }
}

感谢那些能够帮助我的人。

最佳答案

您的网址应类似于 index.php?r=adminUser/update&id=5

关于php - 使用 yii 框架切换到生产环境时出现 404,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28956062/

相关文章:

php - Apache 2.4 .htaccess 通过 Request_URI 绕过基本身份验证

php - WordPress 自定义操作/过滤器执行两次

php - 在 Yii 中全局设置隔离级别

javascript - IE8 上的 jQuery ajax 总是返回错误 : "Type Error: Could not complete the operation due to error 80070005"

design-patterns - Yii 使用单例吗?

asp.net 未按配置显示自定义 404 页面

php - 在php中上传视频和图片

php - Laravel 5.2 验证错误未出现在 Blade 中

.htaccess - 如何使用 .htaccess 将错误 404 重定向到主页?

http-status-code-404 - Magento 2 404 错误管理面板