$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 \n";
$tout .= '$text = array ( ' . "\n";
foreach($text as $key => $value)
{
$tout .= ' "' . $key . '" => array( ' . "\n";
foreach($value as $key2 => $value2)
{
$tout .= ' "' . $key2 . '" => "' . $value2 . '",'. "\n";
}
$tout .= " ), \n";
}
$tout .= "); \n";
$tout .= "?> \n";
$fh = fopen($filename, "w") or die("Could not open log file.");
fwrite($fh, $tout) or die("Could not write file!");
fclose($fh);
return true;
}
我有一个问题,即我发送保存数据的请求,如果它有效,我希望它重定向,但当我这样做时,我得到空白页。
return Yii::$app->getResponse()->redirect('./index.php?r=' . $pages_link[$index + 1])
如果我删除require($filename);
,重定向将完美运行,但数据无法保存(因为我无法从文件中获取数据)
可能是什么问题?
答案 0 :(得分:0)
感谢您的帮助。 根据yiiframework论坛成员的建议找到了解决方案。 详情。看到 http://www.yiiframework.com/forum/index.php/topic/69109-yii-redirect-after-require/