Home > Backend Development > PHP Problem > Can php use css styles?

Can php use css styles?

藏色散人
Release: 2023-02-27 18:18:01
Original
3586 people have browsed it

Can php use css styles?

Can I use css style in php?

Use PHP files to introduce css styles

html:

<link rel="stylesheet" type="text/css" href="http://www.mysite.com/path/?index.css,common.css">
Copy after login

php:

$filename = $_GET;
foreach($filename as $key => $value){
    $filenameArr = $key;
}
$filenameArr = explode(&#39;,&#39; , $filenameArr);
$files = array();
if(count($filenameArr) > 1){
    foreach($filenameArr as $key => $value){
        $arr = explode(&#39;_&#39;, $value);
        $files[] = $arr[0].&#39;.&#39;.$arr[1];
    }
}else{
    $arr = explode(&#39;_&#39;, $filenameArr[0]);
    $files[] = $arr[0].&#39;.&#39;.$arr[1];
}
$context = stream_context_create(
    array(
        "http" => array(
            "header" => "User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36",
        )
    )
);
//css声明
header(&#39;Content-type: text/css&#39;);
$content = &#39;&#39;;
foreach($files as $key => $value){
    $content .= iconv("utf-8", "gb2312",file_get_contents(&#39;http://www.mysite.com/path/to/&#39; . $value, false, $context));
}
echo $content;
Copy after login

For more PHP related knowledge, please visit PHP Chinese website!

The above is the detailed content of Can php use css styles?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template