php 加载的文件 css js返回给html没有效果是什么问题呢?
问题描述
PHP代码
ob_end_clean(); ob_start(); //读取文件mimetype信息 $finfo = finfo_open(FILEINFO_MIME); $mimetype = finfo_file($finfo, $uri); finfo_close($finfo); //打开文件 $file = fopen($uri, 'r'); $file_size = filesize($uri); //声明头信息 Header("Content-type: $mimetype"); Header("Accept-Ranges: bytes"); Header("Accept-Length: ".$file_size); // 输出文件内容 echo fread($file,$file_size); fclose($file);
css内容
html{ font-size: 100px;}
html内容
自动换行 <!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="http://127.0.0.1/res/public/css/style.css"> <title>test</title> </head> <body>
hello world
</body> </html>php 是这样加载css文件的:
http://127.0.0.1/res/public/css/style.css
拆解 /res/public/css/style.css
/res/ 模块
取得真实路径 wwwapppublicrescssstyle.css 并读取返回内容。
实际样式没有应用成功
这是为什么呢?跪求高手解答
问题解答
回答1:html{font-size:100px} 换成 p呢?
相关文章:
1. docker绑定了nginx端口 外部访问不到2. java - 为什么此私有静态变量能被访问呢?3. angular.js - angular内容过长展开收起效果4. docker容器呢SSH为什么连不通呢?5. nignx - docker内nginx 80端口被占用6. docker - 各位电脑上有多少个容器啊?容器一多,自己都搞混了,咋办呢?7. docker网络端口映射,没有方便点的操作方法么?8. php - mysql 模糊搜索问题9. dockerfile - 我用docker build的时候出现下边问题 麻烦帮我看一下10. php - 第三方支付平台在很短时间内多次异步通知,订单多次确认收款
