时间:2021-07-01 10:21:17 帮助过:44人阅读
php无法调用css是因为href为相对路径,其解决办法就是在相对路径中加上STATIC即可,代码语句为“<link rel="stylesheet"href="__STATIC__/bs/css/bootstrap.min.css">”。
推荐:《PHP视频教程》
使用php无法引入css问题
href为相对路径加上STATIC可接解决问题
<html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <link rel="stylesheet" href="__STATIC__/bs/css/bootstrap.min.css"> <script src="__STATIC__/bs/js/jquery.min.js"></script> <script src="__STATIC__/bs/js/bootstrap.min.js"></script> <title>Document</title> </head> <body> </body> </html>
浏览器中查看源代码:
| </pre><!doctype html> | | | <html> | | | <head> | | | <meta charset="UTF-8"> | | | <meta name="viewport" | | | content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> | | | <meta http-equiv="X-UA-Compatible" content="ie=edge"> | | | <link rel="stylesheet" href="[/tp5/public/static/bs/css/bootstrap.min.css](http://localhost/tp5/public/static/bs/css/bootstrap.min.css)"> | | | <script src="[/tp5/public/static//bs/js/jquery.min.js](http://localhost/tp5/public/static//bs/js/jquery.min.js)"></script> | | | <script src="[/tp5/public/static//bs/js/bootstrap.min.js](http://localhost/tp5/public/static//bs/js/bootstrap.min.js)"></script> | | | <title>Document</title> | | | </head> | | | <body> | | | | | | </body> | | | </html> |
以上就是php无法调用css怎么办的详细内容,更多请关注gxlcms其它相关文章!