【发布时间】:2014-01-05 06:11:38
【问题描述】:
我是一名使用 CodeIgniter/Bootstrap/WAMP 的新手。我在访问应用程序文件夹之外的文件夹时遇到问题。我浪费了几个小时试图解决这个问题,但无济于事。我错过了什么吗?这是我到目前为止所做的。
文件目录
www/myapp/application
www/myapp/system
www/myapp/components
components/css
components/js
components/images
我做了什么
edit the config.php
$config['rewrite_short_tags'] =TRUE;
set the autoload.php
$autoload['helper'] = array('url');
template.php
<!DOCTYPE html>
<html>
<head>
<title>PM with BAM</title>
<meta name ="viewport" content="width = device-width, initial-scale=1.0">
<link href="<?php echo base_url();?>components/css/bootstrap.css" rel ="stylesheet" media="screen">
</head>
<body>
<script src="<?php echo base_url();?>components/js/bootstrap.js"> </script>
</body>
</html>
我尝试删除应用程序和系统文件夹中的 .htaccess 文件,但仍然遇到同样的错误。
我已经阅读了一些示例和相关问题,但没有任何效果。 有什么帮助吗?
【问题讨论】:
-
哇哇哇...如果您使用 CI,为什么要使用 includes?正确加载视图。您应该从不在您的 php 代码中需要包含或必需的。
-
哎呀..谢谢你提醒我。我会改的。
-
你也可以像这样将资源的路径传递给
base_url函数:<?php echo base_url('components/js/bootstrap.js');?> -
我已经这样做了,但我得到了同样的错误。
-
我终于解决了这个问题。它与 htacces 文件设置或目录结构无关。从引导网站下载的文件是加密的。我只是取消选中“加密内容以保护数据”选项,然后一切正常。希望这可以帮助像我这样的其他新手。 :)
标签: codeigniter twitter-bootstrap wamp