代码点火器的localhost mamp模型可以正常工作,但是视图没有

时间:2012-03-12 19:44:26

标签: codeigniter view localhost mamp

我有一个奇怪的问题:

我正在使用MAMP和Codeigniter,我看到该视图没有在浏览器上显示任何内容。模型工作,DB连线。 以下是无法在本地主机上运行的代码:

$this->load->view('test/db_tester_view',$data);

可悲的是没有错误信息!!?但这是配置:

$config['base_url'] = 'http://localhost:8888';
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';

我花了20个小时,所以感谢您的帮助

1 个答案:

答案 0 :(得分:4)

一些提示:

确保错误报告正常(这应该在您的引导程序文件index.php中):

error_reporting(E_ALL);
ini_set('display_errors', 1);

确保您没有在脚本中的其他位置禁用这些指令。

Windows和* NIX以不同方式处理大写/小写文件名。确保您的文件都标准化为小写,以避免不同操作系统出现问题。

基本网址需要一个尾部斜杠:

/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
|   http://example.com/
|
| If this is not set then CodeIgniter will guess the protocol, domain and
| path to your installation.
|
*/
$config['base_url'] = 'http://localhost:8888/';
// OR...
$config['base_url'] = ''; // automagic

如果您不需要明确设置端口,则可以将其删除。