Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/270.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在php中通过json_编码重定向_Php_Json_Redirect - Fatal编程技术网

在php中通过json_编码重定向

在php中通过json_编码重定向,php,json,redirect,Php,Json,Redirect,这是我的代码,我想在执行此代码后重定向页面只需使用headerLocation:your_page.php;死前 if ($this->register($email, $register_status)) { $this->sendConfirmationEmail($email); echo json_encode(array("message"

这是我的代码,我想在执行此代码后重定向页面

只需使用headerLocation:your_page.php;死前

if ($this->register($email, $register_status))
                    {
                        $this->sendConfirmationEmail($email);
                        echo json_encode(array("message" => $this->error = $this->l('Your email was registered. Thank You!'),"code" => 1));
                        die();
                    }
如果错误

添加第一行浇头

if ($this->register($email, $register_status))
     {
$this->sendConfirmationEmail($email);
echo json_encode(array("message" => $this->error = $this->l('Your email was registered. Thank You!'),"code" => 1));
header("Location: your_page.php");
die();
                        }

只需使用headerLocation:your_page.php;死前功能!!其中是显示错误XMLHttpRequest无法加载的issuesits。请求的资源上不存在“Access Control Allow Origin”标头。因此不允许访问“来源”。请查看此帖子,这可能会有所帮助http://stackoverflow.com/questions/20035101/no-access-control-allow-origin-header-is-present-on-the-requested-resource
    <?php 
ob_start();
    if ($this->register($email, $register_status))
         {
    $this->sendConfirmationEmail($email);
    echo json_encode(array("message" => $this->error = $this->l('Your email was registered. Thank You!'),"code" => 1));
    header("Location: your_page.php");
    die();
                            }?>