简体   繁体   English

PHP重定向到根PHP文件

[英]PHP Redirect to a Root PHP File

I have a form submission function and upon submission I want the user to be redirected to a view. 我具有表单提交功能,提交后我希望将用户重定向到视图。 But my redirect is adding something on the link. 但是我的重定向是在链接上添加一些内容。

My Directory System is Like this. 我的目录系统就是这样。

exercise3/
         css/
          js/
          inc/
             /Controller
                OperatorController.php
             /Model
                FormModel.php
             include.php
fillup.php
fillup-view.php

My OperatorController.php handles form sumbmission processing which is located at exercise3\\inc\\Controller\\OperatorController.php . 我的OperatorController.php处理表单提交处理,该处理位于exercise3 \\ inc \\ Controller \\ OperatorController.php中。 If form is success I have this 如果形式成功,我有这个

if ($result == '1')
        {

            header("Location: ../fillup-view.php/");      
        }

so basically I'm want the user to be redirected to exercise3/fillup-view.php The problem is it is directed at 所以基本上我希望用户重定向到exercise3 / fillup-view.php,问题在于

 /exercise3/inc/fillup-view.php/

it is inserting "inc" is there something wrong in 它插入“ inc”在哪里有问题

header("Location: ../fillup-view.php/");  

.. is not pointing to root but on inc? ..不是指向root而是指向inc? Thanks! 谢谢!

why don't you try something like this. 你为什么不尝试这样的事情。 $this->redirect(array('controller' => 'controller_name', 'action' => 'fillup-view')); $ this-> redirect(array('controller'=>'controller_name','action'=>'fillup-view')));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM