Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/246.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我的php rooter正在路由我的css/jpg。。。文件夹_Php_.htaccess_Model View Controller - Fatal编程技术网

我的php rooter正在路由我的css/jpg。。。文件夹

我的php rooter正在路由我的css/jpg。。。文件夹,php,.htaccess,model-view-controller,Php,.htaccess,Model View Controller,我有一个自制的php rooter,带有htaccess重写规则,但我的公共文件总是在我离开登录页后被rooter捕获,阻止了其他页面上的源代码 index.php rooter: if(isset($_GET['url']) && !empty($_GET['url'])){ // Explosion of the URL $url = explode('/', $_GET['url']); $controllerName = "Con

我有一个自制的php rooter,带有htaccess重写规则,但我的公共文件总是在我离开登录页后被rooter捕获,阻止了其他页面上的源代码

index.php rooter:

if(isset($_GET['url']) && !empty($_GET['url'])){

    // Explosion of the URL
    $url = explode('/', $_GET['url']);



    $controllerName = "Controllers\\".ucfirst(array_shift($url)).'Controller';

    $methodName = strtolower(array_shift($url));
    $param=strtolower(array_shift($url));

    $controller = new $controllerName;
    if($param!=null){
        $controller->$methodName($param);
    }

    else{
        $controller->$methodName();
    }

}

else{
    header("Location: Views/landing.php");
}
我的访问权限:

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [NC,L]
我应该换个通道吗?但是怎么做呢


Thx

您的客户端资源应按如下方式引用:

<link href="/css/Dashboard/custom.css" type="text/css" rel="stylesheet" />
<link href="/images/favicon/favicon.ico" rel="icon" type="image/png" />
<script src="/bootstrap/dist/js/bootstrap.bundle.min.js" type="text/javascript"></script>
<VirtualHost *:80>
    ServerName local.myapp
    DocumentRoot "/path/to/sample-mvc/public"

    <Directory "/path/to/sample-mvc/public">
        # For developing allow just the development machine 
        # (presuming that all dirs & files are inaccessible by default).
        Require ip 127.0.0.1

        # When Options is set to "off", then the RewriteRule directive is forbidden!
        Options FollowSymLinks
        
        # Activate rewriting engine.
        RewriteEngine On
        
        # Allow pin-pointing to index.php using RewriteRule.
        RewriteBase /
        
        # Rewrite url only if no physical folder name is given in url.
        RewriteCond %{REQUEST_FILENAME} !-d
        
        # Rewrite url only if no physical file name is given in url.
        RewriteCond %{REQUEST_FILENAME} !-f
        
        # Parse the request through index.php.
        # Notice the absence of query string ("?url=...").
        # I use "FastRoute" as router.
        RewriteRule ^(.*)$ index.php [QSA,L]
    </Directory>
</VirtualHost>