【php无限级评论嵌套实现代码】教程文章相关的互联网学习教程文章

php汉字转拼音的实现代码

/*** * Pinyin.php * Example : Pinyin('张洪华',1); //第二个参数随意设置则为utf-8编码 为空默认是gb编码 * edit: bbs.it-home.org**/ function Pinyin($_String, $_Code='gb2312') { $_DataKey = "a|ai|an|ang|ao|ba|bai|ban|bang|bao|bei|ben|beng|bi|bian|biao|bie|bin|bing|bo|bu|ca|cai|can|cang|cao|ce|ceng|cha". "|chai|chan|chang|chao|che|chen|cheng|chi|chong|chou|chu|chuai|chuan|chuang|chui|chun|chuo|ci...

phpmysql数据库复制的实现代码

-- -- 数据库: `db_copy_old` -- -- -- 表的结构 `article` -- CREATE TABLE IF NOT EXISTS `article` ( `id` int(20) NOT NULL auto_increment, `title` text character set utf8 NOT NULL, `content` text character set utf8 NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=gbk AUTO_INCREMENT=4 ; -- -- 转存表中的数据 `article` -- INSERT INTO `article` (`id`, `title`, `content...

php压缩多个CSS文件的实现代码

<?php/* * 压缩css文件 * by bbs.it-home.org /*header(Content-type: text/css);ob_start("compress");function compress($buffer) { /* remove comments */ $buffer = preg_replace(!/\*[^*]*\*+([^/][^*]*\*+)*/!, , $buffer); /* remove tabs, spaces, newlines, etc. */ $buffer = str_replace(array("\r\n", "\r", "\n", "\t", , , ), , $buffer); return $buffer;}/* 加载要压缩的css文件 */include(master....

PHP、Mysql、jQuery找回密码的实现代码

输入您注册的电子邮箱,找回密码: 当用户输入完邮箱并点击提交后,jQuery先验证邮箱格式是否正确,如果正确则通过向后台sendmail.php发送Ajax请求,sendmail.php负责验证邮箱是否存在和发送邮件,并会返回相应的处理结果给前台页面。 jQuery代码: $(function(){ $("#sub_btn").click(function(){ var email = $("#email").val(); var preg = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/; //匹配Email ...

phpjquery多文件上传的实现代码【图】

Upload 2,php多文件上传代码 upload.php//If directory doesnot exists create it. $output_dir = "../upload"; if(isset($_FILES["myfile"])) { $ret = array(); $error =$_FILES["myfile"]["error"]; { if(!is_array($_FILES["myfile"]['name'])) //single file { $fileName = $_FILES["myfile"]["name"]; move_uploaded_file($_FILES["myfile"]["tmp_name"],$ou...

php获取数组中重复数据的实现代码

function FetchRepeatMemberInArray($array) { // 获取去掉重复数据的数组 $unique_arr = array_unique ( $array ); // 获取重复数据的数组 $repeat_arr = array_diff_assoc ( $array, $unique_arr ); return $repeat_arr; } // 测试用例 $array = array ( 'apple', 'iphone', 'miui', 'apple', 'orange', 'orange' ); $repeat_arr = Fet...

phpcurl批量打开网址(curl_multi类)的实现代码

/* * curl_multi 经测试,大于四个网址时要比Foreach循环快.. * by wc1217 * edit:bbs.it-home.org */ class curl_multi{ //Curl句柄 //private $curl_handle = null; //网址 private $url_list = array(); //参数 private $curl_setopt = array( 'CURLOPT_RETURNTRANSFER' => 1, //结果返回给变量 'CURLOPT_HEADER' => 0, //要HTTP头不? 'CURLOPT_NOBODY' => 0, //不要...

phpcurl访问https实现代码

/** * curl POST * * @param string url * @param array 数据 * @param int 请求超时时间 * @param bool HTTPS时是否进行严格认证 * @return string */ function curlPost($url, $data = array(), $timeout = 30, $CA = true){ $cacert = getcwd() . /cacert.pem; //CA根证书 $SSL = substr($url, 0, 8) == "https://" ? true : false; $ch = curl_init(); curl_setopt($ch, CURL...

php使用smtp发送邮件的实现代码

为大家举一个php使用smtp发送邮件的代码,简单实用,有需要的朋友,可以参考下。完整代码如下。'脚本学堂', //这里填写网站名称);$mail = Array ('state' => 1,'server' => 'smtp.abc.com','port' => 25,'auth' => 1,'username' => 'admin@abc.com','password' => '123456','charset' => 'gbk','mailfrom' => 'admin@abc.com');function sendmail($mail_to, $mail_subject, $mail_message) {global $mail, $bfconfig;date_default_...

php微博短网址算法php生成短网址的实现代码

//php生成短网址function code62($x) {$show = '';while($x > 0) { $s = $x % 62; if ($s > 35) { $s = chr($s+61); } elseif ($s > 9 && $s $s = chr($s + 55); } $show .= $s; $x = floor($x/62);}return $show;} function shorturl($url) { $url = crc32($url); $result = sprintf("%u", $url); //return $url; //return $result; return code62($result);}echo shorturl("http://bbs.it-home.org/tags...

php字符串哈希函数算法实现代码

function DJBHash($str) // 0.22{$hash = 0;$n = strlen($str);for ($i = 0; $i <$n; $i++){$hash += ($hash <<5 ) + ord($str[$i]);}return $hash % 701819;} function ELFHash($str) // 0.35{$hash = $x = 0;$n = strlen($str); for ($i = 0; $i <$n; $i++){$hash = ($hash <<4) + ord($str[$i]);if(($x = $hash & 0xf0000000) != 0){$hash ^= ($x>> 24);$hash &= ~$x;}}return $hash % 701819;} function JSHash($str) // 0.23{...

php冒泡排序算法实现代码

//冒泡排序函数 //本函数使用引用,避免内存消耗//整理:bbs.it-home.orgfunction &bubble(&$arr){ $count=count($arr); if($count>1){ for($i=0;$i for($j=$count-1;$j>=$i;$j--){ if($arr[$j-1]>$arr[$j]){ $temp=$arr[$j-1]; $arr[$j-1]=$arr[$j]; $arr[$j]=$temp; } } ...

php选择排序算法实现代码

//选择排序功能函数 //使用引用,减少内存消耗//整理:bbs.it-home.orgfunction &select(&$arr){ $count=count($arr); if($count>1){ for($i=0;$i $k=$i; for($j=$i+1;$j if($arr[$j] $k=$j; } } if($k!=$i){ $tmp=$arr[$k]; $arr[$k]=$arr[$i]; ...

phpgd库为页面添加水印实现代码

header ("content-type: image/png"); $conn = mysql_connect("localhost", "root", ""); //连接数据库 $colname_rs_article = $_get['id']; //获取参数idmysql_select_db("cms", $conn); //执行sql $query_rs_article = sprintf("select * from articles where article_id = %s", $colname_rs_article); $rs_article = mysql_query($query_rs_article, $conn) or die(mysql_error()); $row_rs_article = mysql_fetch_assoc($rs_ar...

Codeigniter多文件上传与缩略图实现代码

<?phpclass Upload extends Controller { function go() { if(isset($_POST[go])) { //初始化 $config[upload_path] = album/source; $config[allowed_types] = gif|jpg|png|bmp|jpeg; $config[encrypt_name] = TRUE; $config[remove_spaces] = TRUE; $config[max_size] = 0; $config[max_width] = 0; $config[max_height] = 0; $this->load->library(upload, $config); ...