Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 67411

Unable to loan external CSS and JS file in php

$
0
0

I am working on a project build on php. I am building it from the scratch using core php. So I boot a server using this

php -S localhost:3000

The problem is I implemented the routing in the application, No my application is unable to load any of the external files. This is the route file :

<?php
// Grabs the URI and breaks it apart in case we have querystring stuff
$request_uri = explode('?', $_SERVER['REQUEST_URI'], 2);

// Route it up!
switch ($request_uri[0]) {
    // Home page
    case '/':
        require '../views/Home/Home.php';
        break;
    // About page
    case '/login':
        require '../views/Login/Login.php';
        break;
    // Everything else
    default:
        header('HTTP/1.0 404 Not Found');
        require '../views/404/404.php';
        break;
}
?>

Here is another file where I want to add some external JS or CSS file :

<?php require_once "../views/Header/Header.php"?>
<script type="text/javascript" src="Login.js"></script>
<link rel="stylesheet"

Now its saying 404 file not found.

File Structure is like this :

---src(root)
   ---public
      ---index.php(route file)
   ---views
      ---Login
         ---Login.php
         ---Login.js
         ---Login.css

File Structure


Viewing all articles
Browse latest Browse all 67411

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>