样式表未链接到PHP页面。尝试过添加下面将要看到的元标记,检查文件位置,但似乎没有解决问题。
这是profile.php文件:
<?php
include("includes/header.php");
?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8"></meta>
<title>My title</title>
<link href="css/style.css" media="screen" rel="stylesheet" type="text/css" />
</head>
<?php
if(isset($_GET['profile_username'])){
$username = $_GET['profile_username'];
$user_details_query = mysqli_query($conn, "SELECT * FROM users WHERE username='$username'");
$user_array = mysqli_fetch_array($user_details_query);
$num_friends = (substr_count($user_array['friend_array'], ",")) - 1;
}
?>
<div class="profile_left">
<img src="<?php echo $user_array['profile_pic']; ?>">
</div>
<div class="profile_info">
<p><?php echo "Posts: " . $user_array['num_posts']; ?></p>
<p><?php echo "Likes: " . $user_array['num_likes']; ?></p>
<p><?php echo "Friends: " . $num_friends ?></p>
<div class="main_column column">
<?php echo $username; ?> This is a profile page.
</div>
</div> <!-- closes wrapper from header.php-->
</body>
</html>
应该适用的style.css类:
.profile_left {
top: -10px;
width: 17%;
max-width: 240px;
min-width: 130px;
height: 100%;
float: left;
position: relative;
background-color: #37b0e9;
border-right: 10px solid #83d6fe;
color: #cbeaf8;
margin-right: 20px;
}
文件层次结构如下:
答案 0 :(得分:1)
尝试以下代码
<link href="/css/style.css" media="screen" rel="stylesheet" type="text/css" />