Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
基本上我的问题是,如果我有一个数字字符串,并且我要将它与数据库进行比较,这是一种安全/安全的检查方式。或者我应该只是逃避我的数字变量以及我的字符串(就像我已经做的那样)?
例子:
<?php $id = $_POST['id']; if(is_numeric($id)){ //database connectivity. } ?>
“数据库”非常笼统,所以我假设您使用的是 MySQL。只要您将其插入$id到查询中,它就是安全的(使用mysql_real_escape_string或最好是准备好的语句)。
$id
mysql_real_escape_string
“从 Id = ' 的 Tbl 中选择”。(int)$_POST['id'] ."'"
我正在学习 perl 模块 IPC::Run。在阅读 cpan 文档时,我遇到了'<pipe'. 我写了一个小程序。在执行时它总是挂起。
'<pipe'
我编写的代码:这只是 cpan doc 的副本。
local (*IN); @cat = ('cat') $h = star