PHP的header()转向失败的一个原因
header()函数用来转向(redirect page)时,如果调用前有输出,比如echo或html标签,就会转向失败。
如果调用前有空行也会转向失败。
还有一个原因,就是注意你的php文件的字符编码。我遇到的情况是,当字符编码为UTF-8时,转向失败,改为ANSI时成功。具体原因不明,仅供参考。
相关文档:
//获取 url
function match_links($document) {
preg_match_all("'<\s*a\s.*?href\s*=\s*([\"\'])?(?(1)(.*?)\\1|([^\s\>]+))[^>]*>?(.*?)</a>'isx",$document,$links);
while(list($key,$val) = each($links[2])) {
if(!empty($val))
$match[] = $val;
}
......
//去除 script 脚 本
function delScript($string){
$pregfind = array("/<script.*>.*<\/script>/siU",'/on(mousewheel|mouseover|click|load|onload|submit|focus|blur)="[^"]*"/i');
$pregreplace = array('','');
$string = preg_replace($pregfind, $pregreplace, $string);
return $str ......
最近在折腾 PHP + MYSQL
的编程。了解了一些 PHP SQL 注入攻击
的知识,于是写了这篇文章 http://www.xiaohui.com/weekly/20070314.htm,总结一下经验。在我看来,引发 SQL 注入攻击
的主要原因,是因为以下两点原因:
1. php 配置文件 php.ini 中的 magic_quotes_gpc
选项没有打开,被置为 off
2. 开发 ......
php和java通用sql语句法
SELECT max(id) from table
该方法在多线程等情况下可能会造成不正确。
java三种方法
1、根据ps的getGeneratedKeys
PreparedStatement ps = conn.prepareStatement(sql,Statement.RETURN_GENERATED_KEYS); //红色是关键
ps.executeUpdate(); //执行后
ResultSet rs = ps.getGeneratedKeys ......