php可以用css樣式嗎?
用PHP檔案引入css樣式
html:
<link rel="stylesheet" type="text/css" href="http://www.mysite.com/path/?index.css,common.css">
php:
$filename = $_GET; foreach($filename as $key => $value){ $filenameArr = $key; } $filenameArr = explode(',' , $filenameArr); $files = array(); if(count($filenameArr) > 1){ foreach($filenameArr as $key => $value){ $arr = explode('_', $value); $files[] = $arr[0].'.'.$arr[1]; } }else{ $arr = explode('_', $filenameArr[0]); $files[] = $arr[0].'.'.$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('Content-type: text/css'); $content = ''; foreach($files as $key => $value){ $content .= iconv("utf-8", "gb2312",file_get_contents('http://www.mysite.com/path/to/' . $value, false, $context)); } echo $content;
更多PHP相關知識,請造訪PHP中文網!
以上是php可以用css樣式嗎的詳細內容。更多資訊請關注PHP中文網其他相關文章!