作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这是我的代码,但是当我提交时出现的问题是在 url“%0A”中发生了这种情况,所以我如何从 url 中删除这-6ren">
<code>
<form action="" method="get">
<table cellspacing="0">
<tbody>
<tr>
<th>Check</th>
<th>Country</th>
<th>Check</th>
</tr>
<?
while($row = mysql_fetch_array($result))
{ ?>
<tr>
<td>
<input type='checkbox' onclick="check()" name='allowed' value='1' <?
$reflex=mysql_query("select distinct * from geocity where isAllowed='1' AND
country='" . $row['Code'] . "'"); $count = mysql_num_rows($reflex); if ($count ==
1{echo 'checked';}else{echo '';} ?>>
</td>
<td><? echo $row['CountryName']; ?></td>
<td>
<input type='checkbox' id="check1" name='countryname' value="<?echo $row['Code'];?>"
<? $reflex = mysql_query("select distinct * from geocity where isAllowed='1' AND
country='" . $row['Code'] . "'"); $count = mysql_num_rows($reflex); if ($count == 1)
{echo 'checked';}else{echo '';} ?>>
</td>
</tr>
<?
};
?>
</tbody>
</table>
<input type="submit" class='button' value="Save">
</form>
</code>
这是我的代码,但是当我提交时出现的问题是在 url“%0A”中发生了这种情况,所以我如何从 url 中删除这个 %0A。网址看起来像这样: example.com/test.php?allowed=1&countryname=AF%0A
最佳答案
%0A
是一个 url 编码字符。
要在 PHP 中删除它们,请使用 urldecode()
功能。
[添加]
如果你想删除添加的空格(这里有一些:value="AF "),使用 trim()
echo
处理中的函数。
并检查您的数据库内容以删除空格 TRIM像这样:
UPDATE countries set countryname = TRIM(countryname);
关于php - 如何从 url 中删除 %0A,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15644097/
我是一名优秀的程序员,十分优秀!