我使用php,html和css创建了一个网站。
我使用<link rel="stylesheet" src="main.css">
将 css 文件调用到html文档,但是当我使用php编写/ echo / print "<link rel="stylesheet" src="main.css">"
时,即使没有加载css在控制台上检测到。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title><?php $this->actn->getAction("pageTitle"); ?></title>
<?php
if(isset($preq[0]) && $preq[0] != "report" && $preq != "action") {
switch($preq[0]) {
default:
echo "<link rel=\"stylesheet\" src=\"".$purl."source/lib/css/main.css\"> \n";
echo "<link rel=\"stylesheet\" src=\"".$purl."source/lib/css/functional.css\"> \n";
echo "<link rel=\"stylesheet\" src=\"".$purl."source/lib/css/header.css\"> \n"; break;
}
} else {
return null;
} ?>
</head>
<body>
<div class="container">
<?php $this->sect->getSection(); ?>
</div>
</body>
</html>
the console that doesn't show anything
注意:我使用的是php 7.0.13
答案 0 :(得分:1)
看看 Difference between SRC and HREF 您需要href属性而不是src,因此请将代码更改为:
echo "<link rel=\"stylesheet\" href=\"".$purl."source/lib/css/main.css\"> \n";
echo "<link rel=\"stylesheet\" href=\"".$purl."source/lib/css/functional.css\"> \n";
echo "<link rel=\"stylesheet\" href=\"".$purl."source/lib/css/header.css\"> \n";
答案 1 :(得分:0)
使用&#39;而不是&#34;对于你的回声,它将更容易,并将防止一些问题。
$params = [
'index' => DATABASE,
'type' => 'XYZ',
'body' =>[
'from' => 0,
'size' => 20,
'query'=>[
'multi_match' => [
'query' => '@gmail.com',
'fields' => [
'email',
'_all'
],
"operator" => 'AND'
]
],
'sort' => ['_score']
]
];