javascript - css 和 js 文件在 php 中不起作用

标签 javascript php css

我正在学习 PHP 中的 MVC。 css 和 js 文件在 php 页面中不起作用。

我正在使用 eclipse,xampp 服务器。

这是我的.htaccess

RewriteEngine On
RewriteCond %{REQUEST_FILENAME)} !-d
RewriteCond %{REQUEST_FILENAME)} !-f
RewriteCond %{REQUEST_FILENAME)} !-l

RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]

这是我的 bootstap.php

<?php
class Bootstap {
   function __construct() {
    $url = isset($_GET ['url'])?$_GET ['url']:null;
    $url = rtrim($url,'/');
    $url = explode ( '/', $url );
    // print_r ( $url );

    if (empty($url[0])){
        require 'controllers/Index.php';
        $controller = new Index();
        return false;
    }
    $file = 'controllers/' . $url [0] . '.php';
    //print_r ( $file );
    if (! file_exists ( $file )) {
        require 'controllers/Error.php';
        $controller = new Error ();
        return false;
    }
    require "$file";
    $controller = new $url [0] ();

    if (isset ( $url [1] )) {
        if (isset ( $url [2] ))
            $controller->$url [1] ( $url [2] );
        else
            $controller->$url [1] ();
    }
  }
 }

我该如何解决这个问题?

最佳答案

RewriteEngine On

RewriteBase /clients

RewriteRule ^(css|images|scripts|js|png|jpg) - [QSA,L]

关于javascript - css 和 js 文件在 php 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29225800/

相关文章:

javascript - 让 mathjax 在 rpc 之后重新加载页面

php - WordPress:如何使用 PHP 和 MySQL 更新数据库中的数据?

php - 通过php将css添加到文件中

python - 将谷歌字体添加到 Flask

html - HTML 布局元素类名称的标准?

javascript - 将对象数组转换为具有分组键作为数组的对象的简单方法

javascript - 在javascript中使用$访问对象的属性

javascript - 为什么 isNaN ("1") 是假的?

php - 如果货币存在,我该怎么办 show x else show y

php - 多对多关系示例