[英]href is not working
I have a prolem when I want to load bootstrap. 我想加载引导程序时遇到问题。 This is my bootstrap.min.css directory:
这是我的bootstrap.min.css目录:
C:/xampp/htdocs/OOPPhp/perpustakaan/bootstrap/css/bootstrap.min.css
C:/xampp/htdocs/OOPPhp/perpustakaan/bootstrap/css/bootstrap.min.css
Then, I want to load it with this code: 然后,我想用以下代码加载它:
<link href="<?= str_replace('\\', '/', baseDir); ?> /bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
I have define baseDir before to get perpustakaan directory using this: 我已经定义了baseDir来使用以下方法获取perpustakaan目录:
define('baseDir', dirname(__DIR__));
But link tag not working. 但是链接标记不起作用。 I try to echo the link in href and the directory result is true.
我尝试回显href中的链接,并且目录结果为true。 Why?
为什么? This is my directory:
这是我的目录:
/perpustakaan /bootstrap /css /bootstrap.min.css /js /images /ui /header.php /listCD.php /index.php
The code is in header.php and I use include_once for header.php in listCD.php and index.php 代码在header.php中,我在listCD.php和index.php中将include_once用于header.php
尝试这个,
<link href="<?='http://'.$_SERVER['SERVER_NAME'].'/OOPPhp/perpustakaan';?>/bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen"> ;
Can you try using relative path to solve the problem rather than using the basedir? 您可以尝试使用相对路径来解决问题,而不是使用basedir吗?
Using "../" to navigate 1 directory above. 使用“ ../”浏览上面的1个目录。
<link href="../bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
Using "./" to access root directory. 使用“ ./”访问根目录。
<link href="./css/bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.