How can I load css or js file in codeigniter 4?
As app is sibling folder of public folder,
And as per codeIgniter 4 .
anything you put in public folder can be accessed directly.
so it should be something like below to get css applied to the view.
In views folder lets say there's a file as index.php
then code should be like below:
index.php
<link rel="shortcut icon" type="image/png" href="/css/style.css"/>
Try this
$config['base_url'] = "http://ur_site_url.com/";
Than in your view
<?php echo base_url('assets/css/style.css'); ?>
Did you add base_url in the application/config/config.php file? Here: http://prntscr.com/pji8a5
Site URL is not defined which you give.
You have given http://localhost:8080/css.....
But It should http://localhost:8080/SITE_URL/css.....
If you add $config['base_url'] = "http://site_url.com/";
then you can give direct base_url('assets/css/style.css');
<link rel="stylesheet" href="<?php echo base_url('assets/css/style.css'); ?>"><script src="<?php echo base_url('assets/js/js.css'); ?>"></script>
Thanks