你好,
我只想在$_GET方法中允许使用数字。我在分页中使用它来确保安全
$page = (isset($_GET['page']) && is_numeric($_GET['page']) ? (int) $_GET['page'] : 1);
如果我输入特殊字符或字母,它会返回错误
这应该是不可能的:
index.php?page=AA和
index.php?page='!@#$%^&*()
只有这个:
index.php?page=1或2 ...
有人有解决方案吗?:) 提前致谢...
我有这个代码
$md_query = "SELECT * FROM table ORDER BY id ASC";
$md_result = mysql_query($md_query, $con);
header('Cache-Control: no-cache, must-revalidate');
header('Content-type: application/json');
while($md_row=mysql_fetch_array($md_result))
$data_row = array(
'id' => $md_row['id'],
'type' => $md_row['type'],
'title' => $md_row['title'],
'content' => $md_row['content'],
'author' => $md_row['postedby'],
'post_date' => $md_row['posteddate'],
'publish' => $md_row['publish']
);
print json_encode($data_row); `
Run Code Online (Sandbox Code Playgroud)
但我只显示1条记录......有人如何解决这个问题?