![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
PHP
happy664618843
这个作者很懒,什么都没留下…
展开
-
PHP环境的配置
<br />一:PHP环境的配置:<br />第一步:下载apache服务器并安装 php开发环境<br />第二步:下载php-5.2.10-Win32.zip 将解压文件 将文件名改成PHP 放在D盘根目录中<br />第三步:将解压的文件夹中php.ini文件放在C:/WINDOWS下<br />第四步:将解压的文件夹中php5ts.dll放在C:/WINDOWS/system32根目录下<br />第五步:修改Apache安装目录中D:/Program Files/Apache原创 2010-07-04 09:50:00 · 635 阅读 · 0 评论 -
php学习网站
<br />西部PHP<br />http://www.westphp.com/<br /> <br />http://www.php100.com<br /> <br />http://www.phpchina.com<br /> <br />电脑编程网<br />http://www.dnbcw.com/biancheng/php/<br /> <br /> <br />http://www.allniu.com/<br /> <br />http://www.nowamagic.net/php/php原创 2010-09-03 19:46:00 · 1244 阅读 · 5 评论 -
遍历一个文件夹下的所有文件和子文件夹
<br /><? function canDir($dir) { $files = array(); if ( $handle = opendir($dir) ) { while ( ($file = readdir($handle)) !== false ) { if ( $file != ".." && $file != "." ) {原创 2010-09-03 20:31:00 · 520 阅读 · 0 评论 -
parse_url parse_str用法
//parse_url解析url 返回一个关联数组 包括url的各种组成部分 scheme - 如 http //host //port //user //pass //path //query - 在问号 ? 之后 $str='http://www.sina.com.cn/abc/de/fg.php?id=1';//得到id=1 的值$strurl=parse_url($str);//将字符串解析到$p中$q=parse_str($strulr['query']原创 2010-09-03 20:41:00 · 1294 阅读 · 0 评论 -
php截取中文字符串
<br />//截取中文字符串function mysubstr($str,$start,$len){ $tmpstr=''; $strlen=$start+$len; for($i=0;$i<$strlen;$i++){ //ord ascii 返回ascii字符串 0xa0表示中文 if(ord(substr($str,$i,1))>0xa0) { $tmpstr.=substr($str,$i,2); $i++; } else{ $tm转载 2010-09-03 20:47:00 · 459 阅读 · 0 评论 -
smarty模板应用入门
<br />Smarty是PHP官方的模板引擎,速度快,功能强大,配置简单适合于做大型项目。简单使用流程:1.从www.smarty.net上下载最新的Smarty版本(以前的下载地址http://smarty.php.net)。解压缩后将其中的libs目录复制你的web站点的根目录下或者需要使用smarty的目录,可以任意改名,此处放到网站根目录下并且改名为Smarty。2.在Smarty目录下的Smarty.class.php是使用Smarty模板引擎进行开发必须包含的主文件。在网站根目转载 2010-09-07 20:09:00 · 643 阅读 · 0 评论 -
多维数组遍历方法
<br />$a=array('fruits'=>array('a'=>'orange', 'b'=>'grape',c=>'apple'), 'numbers'=>array(1,2,3,4,5,6), 'holes'=>array('first',5=>'second', 'third') );原创 2010-09-04 10:31:00 · 1738 阅读 · 0 评论 -
static parent关键字的使用
<br /> class employee{ protected $sal=3000; public function getSal(){ $this->sal=$this->sal+1200; return $this->sal; }} class Manager extends employee { public function getSal(){ parent::getSal();//调用父类的方法 $this->sal=$this->sa原创 2010-09-06 21:46:00 · 599 阅读 · 0 评论 -
PHP ajax分页
<br /><html><head><meta http-equiv="Content-Language" content="en" /><meta name="GENERATOR" content="PHPEclipse 1.0" /><meta http-equiv="Content-Type" content="text/html; charset=GB2312" /><title>title</title><mce:script type='text/javascript'>原创 2010-12-14 21:01:00 · 589 阅读 · 0 评论 -
PHP上传文件封装
<br /><?php class UpFile { public $FilePath = "./images"; public $FileType = array("image/jpeg","image/bmp","image/gif"); public $FileSize = 1000000; function __construct($InputName) { $this->File = $InputName; } function Up原创 2010-12-14 20:37:00 · 1051 阅读 · 0 评论 -
smarty foreach应用
<br />=======无键值数组 from 数组 将数组内容保存在item{foreach from=$name item=id}id: {$id}<br>{/foreach}======= 有键值数组 key 为键 v为值 from 数据源{foreach key=j item=v from=$name }{$j}: {$v}<br>{/foreach}eg:$test=array("a"=>"PHP","b"=>"ASP.NET","C"=>"C++","D"=转载 2010-09-14 21:02:00 · 502 阅读 · 0 评论 -
Php反转字符串函数
header("Content-type:text/html;charset=utf-8"); $str = "bb我是中国人aaaa"; /*** 反转utf8的字符串,使用mb开头的函数* @param string $str* @return string*/function mb_strrev($str) { $len = mb_strlen($str, 'UTF-8'); $string = ''; for ($i = $len -转载 2010-09-03 12:42:00 · 3850 阅读 · 0 评论 -
php常用数组总结
PHP数组函数(70) | |-排序类(13) | |- sort | |- rsort(数组进行逆向排序) | |- ksort( 对数组按照键名排序) | |- krsort(对数组按照键名逆向排序) | |- asort(对数组进行排序并保持索引关系) | |- arsort(对数组进行逆向排序并保持索引关系 )原创 2010-07-20 09:57:00 · 455 阅读 · 0 评论 -
PHP获取文件扩展名方法总结
第一种方法获取文件扩展名:$filename="123.jpg";$fileEx=strtolower(substr(strrchr($filename,"."),1));echo $fileEx;第二种:$extend=pathinfo($filename);echo $extend['extension']第三种:$filetype=array("image/gif","image/jpeg");//判断文件扩展名类型是否在该 数组中in_array($_FILE原创 2010-07-31 09:55:00 · 1812 阅读 · 0 评论 -
php上传文件
<br />html Code<html><body><mce:script type="text/javascript"><!--function chkinput(form){if(form.file.value.length==0){ alert('请选择你要上传的文件!'); return false;}else{return true;}}// --></mce:script><form action="uploadfile.php" method=原创 2010-08-01 11:10:00 · 552 阅读 · 0 评论 -
php格式化时间
date("Y-m-d H:i:s",strtotime($row["validTime"]) //2007-01-18 15:27:31date("Y/m/d H:i:s",strtotime($row["validTime"]) //2007/01/18 15:27:31date("m-d H:i:s",strtotime($row["validTime"]) //01-18 15:27:31date("Y-m-d",strtotime($row["validTime"]) //2007-01-18原创 2010-08-03 14:01:00 · 4270 阅读 · 0 评论 -
php下载文件
<br />function downloadFile($file){if ((isset($file))&&(file_exists($file))) {header("Content-length: ".filesize($file));header('Content-Type: application/octet-stream');header('Content-Disposition: attachment; filename="' . $file . '"');readfi原创 2010-08-07 17:03:00 · 405 阅读 · 0 评论 -
php读取目录下的所有文件
<br />function list_files($dir){if(is_dir($dir)){if($handle = opendir($dir)){while(($file = readdir($handle)) !== false){if($file != "." && $file != ".." && $file != "Thumbs.db"){echo '<a target="_blank" href="'.$dir.$file.'" mce_href="原创 2010-08-07 17:04:00 · 770 阅读 · 0 评论 -
php连接Mysql类的封装
<br />class mysql{private $db_name;private $db_host;private $db_user;private $db_pwd;private $conn;private $querysql;private $result;private $resultarray=array();private $row;//创建构造函数 数据库名 主机名 用户名 密码function __counstruct($dbname,$dbho原创 2010-08-08 17:00:00 · 3022 阅读 · 1 评论 -
php读取xml
<br />xml文件: <books> <book> <author>Jack Herrington</author> <title>PHP Hacks</title> <publisher>O'Reilly</publisher> </book> <book> <author>Jack Herrington</author> <title>Podcasting Hacks</title> <publisher>O'Reilly</publishe转载 2010-09-11 15:53:00 · 393 阅读 · 0 评论 -
php抓取网页代码四种方法
<br />PHP抓取页面代码四种 方法:1. file()函数2. file_get_contents()函数3. fopen()->fread()->fclose()模式4.curl方式 file()方法:<?php$url='http://t.qq.com';$lines_array=file($url);$lines_string=implode('',$lines_array);echo htmlspecialchars($lines_string);?转载 2010-09-09 20:52:00 · 832 阅读 · 0 评论 -
php使用FCK配置
<br />include('fckeditor.php'); //获取运行本页面的文件名 $sBasePath=$_SERVER['PHP_SELF']; //获取文件 所在目录 加上/ $sBasePath=dirname($sBasePath).'/'; $ed=new FCKeditor('con'); //设置FCK的配置路径 $ed->BasePath=$sBasePath; //获取FCK提交的内容if($_POST[sub]){ echo原创 2010-11-24 20:09:00 · 675 阅读 · 0 评论