代码如下:function showtext($text){ $search = array(|(http://[^ ]+)|, |(https://[^ ]+)|, |(www.[^ ]+)|); $replace = array($1, $1, $1); $text = preg_replace($search, $replace, $text); return $text; } 以上就介绍了超链接字体颜色 php中将网址转换为超链接的函数,包括了超链接字体颜色方面的内容,希望对PHP教程有兴趣的朋友有所帮助。
在线演示地址:http://tools.jb51.net/tools/cs.php 代码如下:function zhuanhuan() { $urlodd=explode('//',$_GET["url"],2);//把链接分成2段,//前面是第一段,后面的是第二段 $head=strtolower($urlodd[0]);//PHP对大小写敏感,先统一转换成小写,不然 出现HtTp:或者ThUNDER:这种怪异的写法不好处理 $behind=$urlodd[1]; if($head=="thunder:"){ $url=substr(base64_decode($behind), 2, -2);//base64解密,去掉前面的AA和后面Z...
正好今天朋友 xjb 也碰到了这个问题,所以写了这篇笔记,将此问题的描述以及解决记录下。 问题描述:用 web 方式, 可以链接 mysql, 但是在命令行下, 却提示: Fatal Error: undefined function mysql_connect() 环境: Windows 2003, PHP 5.2.0, MYSQL 5.0, Apache 2.0 在 php.ini 中, 已经将 php_mysql.dll 的模块选项给打开了;测试的脚本也很简单,就一个 mysql_conect 函数,内容如下: 代码如下:php.ini: extension...
代码如下:function makeClickableLinks($text) { $text = eregi_replace((((f|ht){1}tp://)[-a-zA-Z0-9@:%_+.~#?&//=]+), \1, $text); $text = eregi_replace(([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_+.~#?&//=]+),\1\2, $text); $text = eregi_replace(([_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,3}), \1, $text); return $text; } 实现原理:主要是利用正则原理,匹配网址字符或Email来替换成超级链接。以上就介绍了exmail.qq...
1.根据权重获取关键字 代码如下:function getkey($contents){ $rows = strip_tags($contents); $arr = array( , ,"\s", "\r\n", "\n", "\r", "\t", ">", "“", "”"); $qc_rows = str_replace($arr, , $rows); if(strlen($qc_rows)>2400){ $qc_rows = substr($qc_rows, 0, 2400); } $data = @implode(, file("http://keyword.discuz.com/related_kw.html?title=$contents&ics=gbk&ocs=gbk")); preg_match_all("/(.*)A\[(.*)\]\](....
比如分页,因为有些链接已经有参数了,在附加分页信息的时候不能把原有的参数丢掉,所以判断一下链接是否有参数,然后根据需要附加分页信息。 方法很简单: 代码如下:((strpos($url, ?) !== false) ? & : ?); 检查链接中是否含有 ? ,如果有,如: http://www.test.com/index.php?id=id 则直接在链接后面添加一个 & 然后跟上分页信息: http://www.gxlcms.com/index.php?id=id&page=12 如果链接中没有参数,如: http://www.test....
经测试部份邮件链接注册出现解析失败的问题,解决方案如下:修改文件source\class\class_member.php 在该文件中查找$_GET[hash] = preg_replace("/[^\[A-Za-z0-9_\]%]/", , $_GET[hash]);替换成$_GET[hash] = preg_replace("/[^\[A-Za-z0-9_\]%\s+-\/=]/", , $_GET[hash]);邮箱
打开discuz.htm文件 查 forum.php?mod=redirect&tid=$forum[lastpost][tid]&goto=lastpost#lastpost全部修改为: thread-$forum[lastpost][tid]-1-1.html 备注:有三段相同代码的修改,涉及到首页横排、首页竖排和gid大分区,请仔细对照,根据需要自行修改。discuz
function dump_urls(tidy_node $node, &$urls = NULL) { $urls = (is_array($urls)) ? $urls : array(); if(isset($node->id)) { if($node->id == TIDY_TAG_A) { $urls[] = $node->attribute['href']; } } if($node->hasChildren()) { foreach($node->child as $child) { dump_ur...
读取某站点的源文件,再利用正则分析其源代码,得到所有链接 /**********qiushuiwuhen(2002-5-20)***********/if(empty($url))$url = "http://www.csdn.net/expert/";//设置url$site=substr($url,0,strpos($url,"/",8));//站点$base=substr($url,0,strrpos($url,"/") 1);//文件所在目录 $fp = fopen($url, "r" );//打开urlwhile(!feof($fp))$contents.=fread($fp,1024);// $pattern="|href=['\"]?([^ '\"] )['\" ]|U";preg_matc...
$keywordArray = array( array(进程, http://www.01happy.com/linux-ps-view-process/) ,array(守护进程, http://www.01happy.com/linux-python-daemon/));二维数组排序可以使用内置函数usort,代码如下:usort($keywordArray, function($a, $b) { $al = strlen($a[0]); $bl = strlen($b[0]); if ($al == $bl) return 0; return ($al > $bl) ? -1 : 1;});提取出所有html标签preg_match_all(/<\/?[a...
$keys =array(array('网页特效','/js_a/js.html'),array('seo','/seo/seo.html'),array('php','/phper/php.html'),array('jsp','/jsp/jsp.html'),array('asp','/asp/asp.html'),array('ps','/fw/photo.html'),array('photoshop','/fw/photo.html'),array('javascript','/js_a/js.html'),array('.net','/net/net.html'),array('非主流','/fw/photo.html'),array('网络','/mon/mon.html'),array('css','/cssdiv/css.html'),array('平...
$link = array('百度,http://www.baidu.com/','服务器软件,http://s.jbxue.com/','脚本之家,http://bbs.it-home.org/',);$str = '在百度中搜索服务器软件就可以到脚本之家提供的软件夏季不再穿长筒袜近年成为一种时尚,甚至到了秋天也不例外。专家提出,其实这种时尚不利于美腿。据悉,久坐久站缺少运动等原因易导致静脉曲张,尤其是长期站立工作的人,容易引起下肢静脉本身扩张、延长或静脉瓣膜损坏以至发病。具体表现为腿部肿胀,...
PHP:数组 给文章加关键字连接,像163文章内容自动加链接效果 $keys =array( array('网页特效','/js_a/js.html'), array('seo','/seo/seo.html'), array('php','/phper/php.html'), array('jsp','/jsp/jsp.html'), array('asp','/asp/asp.html'), array('ps','/fw/photo.html'), array('photoshop','/fw/photo.html'), array('javascript','/js_a/js.html'), array('.net','/net/net.html'),...
字节顺序记号(英:byte-order mark,BOM)是位于码点 U+FEFF 的统一码字符("零宽度无断空白")。当以 UTF-16 或 UTF-32 来将UCS/统一码字符所组成的字串编码时,这个字符被用来标示其字节序。它常被用来当做标示文件是以 UTF-8 、 UTF-16 或 UTF-32 编码的记号。 class cryption { function en($str,$key) { $ret=''; $str = base64_encode ($str); for ($i=0; $i $d_str=substr($str, $i, 1); $int =ord($d_str); $...