$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?