PHP 工厂模式使用方法

yipeiwu_com6年前
基本的工厂类 复制代码 代码如下: class MyObject{ //对象将从工厂返回 } class MyFactory{ public static function factor...

php生成的html meta和link标记在body标签里 顶部有个空行

yipeiwu_com6年前
1.php中用smarty模板生成的html在浏览器中顶部有一空行. 2.用firedebug发现 meta和link标记在body标签里. 本机上wmap运行没事, 送到远程服务器上是...

php UTF-8、Unicode和BOM问题

yipeiwu_com6年前
php UTF-8、Unicode和BOM问题
一、介绍 UTF-8 是一种在web应用中经常使用的一种 Unicode 字符的编码方式,使用 UTF-8 的好处在于它是一种变长的编码方式,对于 ANSII 码编码长度为1个字节,这样...

Joomla下利用configuration.php存储简单数据

yipeiwu_com6年前
写入过程 复制代码 代码如下: // Get the path of the configuration file $fname = JPATH_CONFIGURATION.DS.'co...

php 编写安全的代码时容易犯的错误小结

yipeiwu_com6年前
1.不转意html entities 一个基本的常识:所有不可信任的输入(特别是用户从form中提交的数据) ,输出之前都要转意。 echo $_GET['usename'] ; 这个例...

用PHP将网址字符串转换成超链接(网址或email)

yipeiwu_com6年前
复制代码 代码如下: function makeClickableLinks($text) { $text = eregi_replace('(((f|ht){1}tp://)[-a-z...

PHP 图像尺寸调整代码

yipeiwu_com6年前
复制代码 代码如下: /********************** *@filename - path to the image *@tmpname - temporary path...

PHP 强制性文件下载功能的函数代码(任意文件格式)

yipeiwu_com6年前
复制代码 代码如下: /******************** *@file - path to file */ function force_download($file) { if...

PHP 创建标签云函数代码

yipeiwu_com6年前
复制代码 代码如下: function getCloud( $data = array(), $minFontSize = 12, $maxFontSize = 30 ) { $mini...

PHP为表单获取的URL 地址预设 http 字符串函数代码

yipeiwu_com6年前
复制代码 代码如下: if (!preg_match("/^(http|ftp):/", $_POST['url'])) { $_POST['url'] = 'http://'.$_PO...