匹配中文字符的正则表达式: [u4e00-u9fa5]
匹配双字节字符(包括汉字在内): [^x00-xff]
应用:计算字符串的长度(一个双字节字符长度计2,ASCII字符计1)
从网上看看了一些php下载文件的资料,改了改,写了这么个函数.
function delhtml($content){ $content = eregi_replace("<html>.+</head>","", $content); $content = preg_replace("/<.+?>/i","", $content); return $content; } $oneurl = "http://www.chenapp.com"; $content = file_get_contents($oneurl); echo delhtml($content);
1. 安装phpcd /usr/ports/lang/php5make config 这里记得选上fast-cgimake install clean
完成后,记得拷贝php的配置文件:cp /usr/local/etc/php.ini-recommended /usr/local/etc/php.ini
安装扩展cd /usr/ports/lang/php5-extensions/make install clean
2. 安装nginxcd /usr/ports/www/nginxma...
【1】页面之间无法传递变量 get,post,session在最新的php版本中自动全局变量是关闭
的,所以要从上一页面取得提交过来得变量要使用$_GET['foo'],$_POST
['foo'],$_SESSION['foo']来得到。当然也可以修改自动全局变量为开(php.ini改为
register_globals = On);考虑到兼容性,还是强迫自己熟悉新的...
凡是与session有关的,之前必须调用函数session_start();为session付值很简单,如:
<?phpSession_start();$Name = "这是一个Session例子";Session_Register("Name");//注意,不要写成:Session_Register("[color=red]$Name[/color]");Echo $_SESSION["Name"];//之后$...