codeigniter를 사용하여 routes.php에 텍스트를 추가하려고합니다. config/routes.php에 텍스트를 추가하고 route.php 파일을 777 권한으로 업데이트했지만 작동하지 않았습니다. 여기codesigniter를 사용하여 controlslar에 routes.php 파일을 쓰는 방법은 무엇입니까?
내 문제를 해결하는 방법
$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);
}
모든 아이디어를 내 코드?
정말이 솔루션을 원하십니까? 다시 생각해 보시고'$ route [ '404_override'] = '';를 사용 하시어 컨트롤러를 통해 이것을 실행 시키십시오. 컨트롤러는'uri' 라이브러리와 데이터베이스 값을 기반으로 결정을 내릴 수 있습니다. 'route.php'와 같이 PHP 파일을 동적으로 수정하는 것은 피하십시오. 왜냐하면 약간의 생성 오류가 발생하면 전체 웹 사이트가 종료 될 것이기 때문입니다. –