dqtm8504 2015-12-30 20:33
浏览 84

Yii框架(需要和重定向)

    $filename ='here is the name of the file ,the name is correct and i can print it';
    require($filename); //this sentenct give me the problem

    foreach($array as $key => $value) {
        $text[$key] = array_merge($text[$key],$value);
    }

    //protection ????
    $tout = "<?php 
";
    $tout .= '$text = array ( ' . "
";
    foreach($text as $key => $value)
    {
        $tout .= '    "' . $key . '" => array( ' . "
";
        foreach($value as $key2 => $value2)
        {
            $tout .= '        "' . $key2 . '" => "' . $value2 . '",'. "
";
        }
        $tout .= "    ), 
";
    }
    $tout .= "); 
";
    $tout .= "?> 
";

    $fh = fopen($filename, "w") or die("Could not open log file.");
    fwrite($fh, $tout) or die("Could not write file!");
    fclose($fh);
    return true;
}

I have a problem whereby I am sending a request to save data and if it works I want it to redirect, but when i do that I get blank page.

 return Yii::$app->getResponse()->redirect('./index.php?r=' . $pages_link[$index + 1])

If I remove require($filename); the redirect will work perfectly but the data doesn't get saved (because I don't get the data from the file)

What could be the problem?

  • 写回答

1条回答 默认 最新

  • drfrvbq736383 2016-01-02 22:43
    关注

    Thanks for your help. Solution was found thanks to the suggestions of a member of yiiframework forum. For details. see http://www.yiiframework.com/forum/index.php/topic/69109-yii-redirect-after-require/

    评论

报告相同问题?

悬赏问题

  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100