使用CI禁止目录访问

时间:2017-05-26 20:14:15

标签: php

我无法访问它显示的目录“目录访问被禁止”请帮助我,因为我是CI的新手

<?php     
 if ( ! defined('BASEPATH')) exit('No direct script access allowed');  
$config['base_url'] = 'emoneygifts.projects-codingbrains.com/index.php';

?>

1 个答案:

答案 0 :(得分:0)

  

来自文档https://codeigniter.com/user_guide/installation/index.html   在您的application/config/config.php制作设置中

$config['base_url'] = 'http://'. $_SERVER['HTTP_HOST'] .'/your_project/'; 
  

完成后,访问您的网站:   http://localhost/your_project/index.php

示例:

$config['base_url'] = localhost/Project_name/index.php';

$config['base_url'] = 'http://'. $_SERVER['HTTP_HOST'] .'/project_name/index.php';