-
php 使用 PHPMailer 通过 SMTP 发送邮件 日期:2014-06-19 02:26:17 点击:74 好评:0
使用 PHPMailer 通过 SMTP 发送邮件 **[PHP]代码**```{.php}# Include PHP Mailer Classrequire_once(quot;class.phpmailer.phpquot;);# Create object of PHPMailer$mail = new PHPMailer();// Inform class to use SMTP$mail-gt;IsSMTP();...
-
php得到当前页面的完整地址 日期:2014-06-19 02:17:19 点击:126 好评:0
php得到当前页面的完整地址 ```{php}function full_url(){$s = empty($_SERVER[quot;HTTPSquot;]) ? #39;#39; : ($_SERVER[quot;HTTPSquot;] == quot;onquot;) ? quot;squot; : quot;quot;;$protocol = substr(strtolower($_SERVER[quot;SERVER_PRO...
-
文件下载 PHP 强制文件下载 日期:2014-06-19 02:17:06 点击:190 好评:0
PHP 强制文件下载 进入指定页面后就弹出文件下载对话框**[PHP]代码**```{.php}/** * Downloader * * @param $archivo * path al archivo * @param $downloadfilename * (null|string) el nombre que queres usar para el arc...
-
数组排序 php专用数组排序的类 ArraySortUtil 日期:2014-06-19 02:16:52 点击:201 好评:0
php专用数组排序的类 ArraySortUtil ```{php}/** * ArraySortUtil is a array sort utility, you can extends the sorting engine. */ class ArraySortUtil { static function uasort($unsort, $fields) { if...
-
php 正则表达式替换字符串中的全角字符 日期:2014-06-19 02:16:38 点击:185 好评:0
正则表达式替换字符串中的全角字符 如下代码替换全角字符:```{php}function zo_replace(text) { return text amp;amp; text.replace(/[\u3000\uff01-\uff5f]/g, function($0) { return $0 == quot;\u3000quot; ? quot; quot; : St...
-
php实现时间友好格式化 日期:2014-06-19 02:16:24 点击:138 好评:0
php实现时间友好格式化 **[PHP]代码**```{.php}lt;?phpclass DateFormat{private static $_DIFF_FORMAT = array(#39;DAY#39; =gt; #39;%s天前#39;,#39;DAY_HOUR#39;=gt; #39;%s天%s小时前#39;,#39;HOUR#39; =gt; #39;%s小时#39;,#39;HOUR_M...
-
php发邮件给多人 日期:2014-06-19 02:16:10 点击:121 好评:0
php发邮件给多人 **php发邮件给多人****[PHP]代码**```{.php}//class.emailer.phpclass Emailer{ private $sender; private $recipients; private $subject; private $body; function __construct($sender)...
-
php实现文件缓存代码 日期:2014-06-19 02:15:56 点击:87 好评:0
php实现文件缓存代码 在web开发中,可以通过文件缓存,大大缓解数据库的压力。 如下代码是php中使用文件缓存的例子。** CacheLayer.php **```{.php}lt;?phpclass CacheLayer{ protected $root = quot;quot;;...
-
php 遍历某文件夹下的所有文件和文件夹 日期:2014-06-19 02:15:43 点击:150 好评:0
遍历某文件夹下的所有文件和文件夹 **php代码遍历某文件夹下的所有文件和文件夹**```{.php}function list_dir($dirpath){ if($dirpath[strlen($dirpath)]-1!=#39;/#39;){ $dirpath.=quot;/quot;; } static $result_array=ar...
-
php获得文件的更新时间 日期:2014-06-19 02:15:27 点击:134 好评:0
php获得文件的更新时间 ```php/* * @param string $file Filepath * @param string $format dateformat * @link http://www.php.net/manual/de/function.date.php * @link http://www.php.net/manual/de/function.filemtime.php...
-
PHP 文件上传代码示例 日期:2014-06-19 02:15:13 点击:129 好评:0
PHP 文件上传代码示例 **PHP 文件上传代码示例**```{.php}lt;htmlgt;lt;headgt;lt;titlegt;图片上传lt;/titlegt;lt;/headgt;lt;bodygt;lt;form enctype=quot;multipart/form-dataquot; method=quot;postquot; name=quot;upformquot;gt;上传...
-
php 根据生日计算年龄 日期:2014-06-19 02:14:53 点击:182 好评:0
根据生日计算年龄 ```{.php}function age($date){$year_diff = #39;#39;;$time = strtotime($date);if(FALSE === $time){return #39;#39;;}$date = date(#39;Y-m-d#39;, $time);list($year,$month,$day) = explode(quot;-quot;,$dat...
-
php生成图像缩略图(支持:JPEG,GIT,PNG,BMP) 日期:2014-06-19 02:14:39 点击:141 好评:0
php生成图像缩略图(支持:JPEG,GIT,PNG,BMP) **thumb.php ~ 7KB 下载(27)**```{.php}lt;?phpclass Thumb{ public function create($srcPath, $dstPath, $dstWidth, $dstHeight) { if (!file_exi...
-
PHP 往 XML 中添加节点 日期:2014-06-19 02:14:26 点击:136 好评:0
PHP 往 XML 中添加节点 **contacts.xml**```{.xml}lt;contact id=quot;43956quot;gt; lt;personalgt; lt;namegt; lt;firstgt;Jlt;/firstgt; lt;middlegt;Jlt;/middlegt; lt;lastgt;Jlt;/lastgt; lt;...
-
缩略图 php生成缩略图代码 日期:2014-06-19 02:01:06 点击:189 好评:0
php生成缩略图代码 ```{php}/***********************@filename - path to the image*@tmpname - temporary path to thumbnail*@xmax - max width*@ymax - max height*/function resize_image($filename, $tmpname, $x...
-
PHP文件缓存类 日期:2014-06-19 02:00:52 点击:148 好评:0
PHP文件缓存类 一个PHP缓存类,设置详细内容见代码里面**[PHP]代码**```{.php}cache.inc.php:lt;?phpclass Cache { /** * $dir : 缓存文件存放目录 * $lifetime : 缓存文件有效期,单位为秒 * $cacheid : 缓存文...
-
php常用正则表达式,验证用户名,密码,Email,Url等 日期:2014-06-19 02:00:38 点击:93 好评:0
php常用正则表达式,验证用户名,密码,Email,Url等 ```{.php}lt;?phpclass Verify{/** * 验证用户名 * @param string $value * @param int $length * @return boolean */public static function isNames($value, $minLen=2, $maxLen...
-
PHP多线程例子 日期:2014-06-19 02:00:13 点击:71 好评:0
PHP多线程例子 PHP多线程--- 内部多线程**[PHP]代码**```{.php}lt;?php/*本代码来自:http://www.cnblogs.com/niniwzw/archive/2010/01/30/1659589.html*/class Http_MultiRequest{...
-
PHP 截取中文字符串(支持多种编码) 日期:2014-06-18 20:49:34 点击:148 好评:0
PHP 截取中文字符串(支持多种编码) 通过使用多种方法来实现中文字符串的完美截取,在未安装mbstring 和 iconv扩展情况下支持UTF-8、GBK、GB2312、BIG5编码,安装上述扩展后支持的编码更多...
-
PHP递归对文件夹递归执行chmod命令 日期:2014-06-18 20:49:20 点击:178 好评:0
PHP递归对文件夹递归执行chmod命令 ```{php}lt;? function recursiveChmod($path, $filePerm=0644, $dirPerm=0755) { // Check if the path exists if(!file_exists($path)) { return(FALSE); }...