源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

收藏的PHP常用函数 推荐收藏保存

  • 时间:2020-11-09 20:47 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:收藏的PHP常用函数 推荐收藏保存
内容:
[url=$url]print " </tr>n"; print " </tr>n"; print " </table></td>n"; print " </tr>n"; print " <tr>n"; print " <td height="200"> </td>n"; print " </tr>n"; print "</table>n"; print "</body>n</html>"; exit; ?>
产生随机字符串函数 截取一定长度的字符串(该函数对GB2312使用有效)
[url=//]$new_content = preg_replace('/src="//', 'src="'.$protocol[0].$server_url.'/', $new_content); } else { $new_content = $content; } return $new_content; } ?>
[u]复制代码[/u] 代码如下:
//HTML表格的每行转为CSV格式数组 <? function get_tr_array($table) { $table = preg_replace("'<td[^>]*?>'si",'"',$table); $table = str_replace("</td>",'",',$table); $table = str_replace("</tr>","{tr}",$table); //去掉 HTML 标记 $table = preg_replace("'<[/!]*?[^<>]*?>'si","",$table); //去掉空白字符 $table = preg_replace("'([rn])[s]+'","",$table); $table = str_replace(" ","",$table); $table = str_replace(" ","",$table); $table = explode(",{tr}",$table); array_pop($table); return $table; } ?>
[u]复制代码[/u] 代码如下:
//将HTML表格的每行每列转为数组,采集表格数据 <? function get_td_array($table) { $table = preg_replace("'<table[^>]*?>'si","",$table); $table = preg_replace("'<tr[^>]*?>'si","",$table); $table = preg_replace("'<td[^>]*?>'si","",$table); $table = str_replace("</tr>","{tr}",$table); $table = str_replace("</td>","{td}",$table); //去掉 HTML 标记 $table = preg_replace("'<[/!]*?[^<>]*?>'si","",$table); //去掉空白字符 $table = preg_replace("'([rn])[s]+'","",$table); $table = str_replace(" ","",$table); $table = str_replace(" ","",$table); $table = explode('{tr}', $table); array_pop($table); foreach ($table as $key=>$tr) { $td = explode('{td}', $tr); array_pop($td); $td_array[] = $td; } return $td_array; } ?>
[u]复制代码[/u] 代码如下:
//返回字符串中的所有单词 $distinct=true 去除重复 <? function split_en_str($str,$distinct=true) { preg_match_all('/([a-zA-Z]+)/',$str,$match); if ($distinct == true) { $match[1] = array_unique($match[1]); } sort($match[1]); return $match[1]; } ?>
[u]复制代码[/u] 代码如下:
//打印出为本PHP项目做出贡献的人员的清单 <? string phpcredits(void) ?>
  • 全部评论(0)
上一篇:php4的彩蛋
下一篇:PHP学习之正则表达式
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部