用于单个页面PHP的CSS
我有一个网站在php与帐户。我想为“profile.php/user”(例如:profile.php/benjamin)编写一个CSS。我试图将这一行放在profile.php中:用于单个页面PHP的CSS,php,html,Php,Html,我有一个网站在php与帐户。我想为“profile.php/user”(例如:profile.php/benjamin)编写一个CSS。我试图将这一行放在profile.php中: <link rel="stylesheet" type="text/css" href="profile.css"> 但显然不起作用 profile.php <?php session_start(); if($_SESSION['logged'] == true){ $userna
<link rel="stylesheet" type="text/css" href="profile.css">
但显然不起作用
profile.php
<?php
session_start();
if($_SESSION['logged'] == true){
$username = $_SESSION['login_username'] ;
$username = strtoupper($username); //il facem uppercase
echo "Welcome ".$username;
echo "</br>Press here to go to the home page";
echo "</br>Click <a href='/logout.php'> here </a> to log out.";
}
else {
echo " </br></br></br>You must login first to see this section ";
header("refresh:4;url=/index.php");
}
?>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <!--scalare pagina in functie de dispozitiv -->
<link rel="stylesheet" type="text/css" href="profile.css">
<html>
<body>
<div class = "top_band"></div>
</body>
</html>
假设CSS文件与脚本位于同一目录中,则应为:
<link rel="stylesheet" type="text/css" href="../profile.css">
这是因为就浏览器而言,profile.php/
是URL中的一个目录。要返回到相同的级别,您必须在URL中使用。/
浏览器不知道任何关于实际文件位置的信息,也不知道URL的哪些部分是目录、文件名和参数,它只是对其进行文本解析
/
只是分隔目录级别,而。/
在解析相对URL时删除一个尾随目录级别。解释显然不起作用。在profile.php
中向我们展示完整的代码,还有什么不起作用?浏览器的开发工具中是否有错误?我们需要更多的信息来帮助你。