我想用我的css文件。
我用了
$this->Html->css(array('style'), array('charset'=>'utf-8', 'inline' => false));
但是这段代码一直指向'myPageFolder / css / style.css'。不是'myPageFolder / app / webroot / css / style.css'
我怎样才能使代码指向/app/webroot/css/style.css
试试下面的代码
<?php
echo $this->fetch('css');
echo $this->Html->css('style');
?>
root htaccess yourapp / .htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
在yourapp / app / .htaccess中找到htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
webroot /app/webroot/.htaccess中的htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
请检查根目录yourapp / index.php中的index.php
<?php
define('APP_DIR', 'app');
define('DS', DIRECTORY_SEPARATOR);
define('ROOT', dirname(__FILE__));
define('WEBROOT_DIR', 'webroot');
define('WWW_ROOT', ROOT . DS . APP_DIR . DS . WEBROOT_DIR . DS);
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'lib');
}
require APP_DIR . DS . WEBROOT_DIR . DS . 'index.php';
?>