I using codeigniter to trying add text in routes.php , What I want to do is add text in config/routes.php, I had update the route.php file to 777 permission, but it was not working.
here is my code
$file_path = "var/www/html/staging/oscar/anthola/application/config/routes.php";
$file_exists = read_file($file_path);
$slug ="123";
if ( ! write_file($file_path, $slug))
{
echo 'Unable to write the file';
echo write_file('./config/routes.php', $slug);
}
else
{
echo 'File written!';
echo write_file('./config/routes.php', $slug);
}
Any idea how to solve my problem?
I agree with Robin’s comments, but if this is the route you want to go down then I would recommend adding the following line towards the bottom of your routes.php file:
This way, you won’t be overwriting the
default_controllerand404_overrideroutes, but will still be able to add additional routes to your Codeigniter application.In your controller, you can then just add the following couple of lines
Hope that helps.