Php Yii框架(要求和重定向)
如果我删除Php Yii框架(要求和重定向),php,yii,yii2,Php,Yii,Yii2,如果我删除require($filename)重定向可以很好地工作,但是数据没有保存(因为我没有从文件中获取数据) 有什么问题吗?谢谢你的帮助。 由于yiiframework论坛一位成员的建议,找到了解决方案。 详情请参阅。看见 首先尝试检查文件是否存在,以确定是否存在。在不了解您试图执行的操作的情况下,我建议检查路径是否正确,因为需要文件的完整路径。可能存在的问题:exit包含在包含的文件中,包含的文件中出现语法错误,包含的文件中激活了输出缓冲,无限重定向/包含。。。首先确保所有的错误都被报告
require($filename)代码>重定向可以很好地工作,但是数据没有保存(因为我没有从文件中获取数据)
有什么问题吗?谢谢你的帮助。
由于yiiframework论坛一位成员的建议,找到了解决方案。
详情请参阅。看见
首先尝试检查文件是否存在,以确定是否存在。在不了解您试图执行的操作的情况下,我建议检查路径是否正确,因为需要文件的完整路径。可能存在的问题:exit
包含在包含的文件中,包含的文件中出现语法错误,包含的文件中激活了输出缓冲,无限重定向/包含。。。首先确保所有的错误都被报告了,否则你就要去寻找鬼魂了。
$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])