我正在尝试将以下内容写入$routeconfig
文件但是我只得到以下结果我怎样才能使它完整地写入$route[] = data
?
结果:
screenings/details/$1/$2
page/load/2949/screenings
代码:
public function hook_process()
{
if (!file_exists('../cache/'.DOMAIN_NAME.'-routes.php'))
{
$modelData = $this->CI->routes_hook->getData();
foreach($modelData as $data)
{
if($data['post_url_link'] == 'screenings')
{
$routeConfig[] = $route['screenings/details/(:any)/(:any)'] = 'screenings/details/$1/$2';
$routeConfig[] = $route['screenings'] = 'page/load/'.$data['post_id'].'/'.$data['post_url_link'].'';
}
$output = implode("\n", $routeConfig);
$fp = fopen(''.$_SERVER['DOCUMENT_ROOT'].'/cache/'.DOMAIN_NAME.'-routes.php', 'w+');
fwrite($fp, $output);
fclose($fp);
}
}
}