如何解决网址?
我使用echo来调出一个标签。它运行良好,但URL包括一些我不明白如何解决它?谁能向我解释一下?为什么没有URL会有%20%20%
这是我回应的网址
http://localhost/pme/main/directMessageRoom.php?directMessageRoomID=1></a>%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cform%20method=
这是我的代码
<div class ="direct-message-btn-container ">
<?php
include '../config.php';
if(isset($_SESSION['id'])){
$target = $_GET['user'];
$id = $_SESSION['id'];
$targetusername = mysqli_query($connection,"SELECT username FROM user WHERE id='$target' ")or die(mysqli_error($connection));
$username= mysqli_query($connection,"SELECT username FROM user WHERE id='$id'") or die(mysqli_error($connection));
$dm_sql="SELECT * FROM direct_message_room WHERE user_1_id ='$id' AND user_2_id='$target' OR user_1_id='$target' AND user_2_id='$id'";
$check_direct_message_room = mysqli_query($connection, $dm_sql) or die(mysqli_error($connection));
$check= mysqli_num_rows($check_direct_message_room);
if($check == 0){
$rowUserName=mysqli_fetch_array($username);
$rowTargetUserName=mysqli_fetch_array($targetusername);
$room_name=$rowUserName['username']. ' and ' . $rowTargetUserName['username'];
$direct_message_room_name ="INSERT INTO direct_message_room(`direct_message_room_name`,`user_1_id`,`user_2_id`) VALUES ('$room_name','$id','$target')";
$newDirectMessageRoom = mysqli_query($connection,$direct_message_room_name)or die(mysqli_error($connection));
$direct_message_room_id = mysqli_insert_id($connection);
echo '<a href="directMessageRoom.php?directMessageRoomID='.$direct_message_room_id.'></a>';
}
else{
while($row3 = mysqli_fetch_array($check_direct_message_room)){
echo '<a href="directMessageRoom.php?directMessageRoomID='.$row3['id'].'></a>';
}
}
?>
<form method="post" action="" role="form">
<div class="form-group ">
<input type = "submit" class="btn content-btn btn-direct-message" value="message" name="chat">
</div>
</form>
</div>
答案 0 :(得分:2)
您忘记关闭href
属性(双引号):
echo '<a href="directMessageRoom.php?directMessageRoomID='.$row3['id'].'"></a>';
right here ---^
答案 1 :(得分:1)
要注意很多白色空间&#39;在您的表单字段中。例如,您的提交按钮,您可以写下constructor(private _runtimeCompiler: RuntimeCompiler)
。您不小心插入了空白区域。它应该是this._runtimeCompiler.clearCache();
。