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. javascript - 原生canvas中如何获取到触摸事件的canvas内坐标?2. javascript - 移动端粘贴事件,onpaste事件在app中无效,在app中怎么监测到粘贴事件3. python - 在使用Pycharm时经常看到如下的样式,小括号里红色的部分是什么意思呢?4. javascript - 关于fullpage.js 自动高度失效的问题5. android - react-native 的headless.js Java API 的代码怎么使用?6. angular.js - angular2 有什么cool的loading组件么?7. javascript - Express 和 request 如何代理远程图片?8. python - Scrapy存在内存泄漏的问题。9. javascript - 你们怎样实现前端分页的?10. mac连接阿里云docker集群,已经卡了2天了,求问?
