<?php
/*
抛个砖,具体要做成什么样自己做。
*/
if(isset($_FILES['userfile']['tmp_name'])){
$userfile = $_FILES['userfile']['tmp_name']; //保存在系统的临时位置
$userfile_name = $_FILES['userfile']['name'];//文件名
$userfile_size = $_FILES['userfile']['size'];//文件大小,字节
$userfile_type = $_FILES['userfile']['type'];//文件类型
if(!is_dir("image")) mkdir ("image", 0700);
$upfile = "image/".$userfile_name;//保存位置
print_r($_FILES);
//move_uploaded_file($userfile,$upfile);//方法1
if(!copy($userfile,$upfile))//方法2
{
echo "上传失败";
exit();
}
echo "上传成功";
echo "<a href=\"#\" onClick=\"window.history.back();\">再上传一张</a>";
}
else{
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
......
1,类的结构声明方式:
class 类名 {
//类体
}
2,属性和方法的定义;
使用构造函数:
使用析构函数:
类的实例化:
3,控制访问权限:public , private protected;
4,类的继承:class B extends A { } 重载:子类和父类函数同名;
用final对继承和重载进行限制;
5,接口:在PHP5中引用的,其可以看作多继承的解决方案。思想是指定一个实现
了该接口的类必须实现的一系列方法;用关键字:interface进行声明;
interface test{ function fun ( ) } 声明test接口,并定义了方法;
class work implements test{ function fun( ) { } } 指定类所要实现的接口和方法;
6,PHP面向对象的新特征:
a, Per-Class ; class test { const mr="明日冬瓜"; } echo test::mr;
$obj2=clone $obj1; 对象的克隆;
b, __autoload (方法) 用于尝试包含任何初始化所需类的文件;
function __autolo ......
1,定位数组:
bool in_array ( mixed needle,array haystack[,bool strict]) 查找指定元素;
array array_keys (arraqy input [, mixed search_value]) 返回键值组成的数组;
bool array_key_exists(mixed key,array search) 判断键值是否为指定的键值;
array array_values (array input) 返回数组中的元素值;
2, 遍历数组:
mixed key (array input ) 返回当前指针元素的键值;
mixed reset ( array input_array ) 将指针重置到数组的起始位置;
array each (array input_array ) 返回当前指针位置的数组值;
mixed current (array input_array ) 返回当前指针位置的数组元素值;
mixed end ( array input_array ) 返回当前指针指向最后一个元素;
mixed next (array input_array ) 返回当前指针下一位置的数组元素;
mixed prev (array input_array ) 返回位于当前指针前一个位置的数组值;
3,增加,删除数组元素:
int array_push( array & array,mixe var [, mixed ...])将指定数值增加到数组的末尾;
mixed array_pop (array & array) 返回数组的最后一个元素,并重置数组指针;
mixed arr ......
php中,关于整除的3个函数
2008-10-23 23:25
Ceil: 计算大于指定数的最小整数。
Floor: 计算小于指定数的最大整数。
round: 四舍五入。
根据需要选用
<?php
$a=20;
$b = 6;
echo ($a/$b)."<br>"; //out 3.3333333333333
echo ceil($a/$b)."<br>"; //out 4
echo floor($a/$b)."<br>"; //out 3
echo round($a/$b)."<br>"; //out 3
?>
......
首先安装完php
后最好保留当时安装的文件,比如我的路径/export1/soft
#cd php-5.2.8/ext/soap
#/usr/local/php/bin/phpize
#./configure --with-php-config=/usr/local/php/bin/php-config
--enable-soap
#make
#make install
编译后的soap.so
文件保存在了/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613
目录下
修改php.ini
文件
手工修改:查找/usr/local/php/etc/php.ini
中的extension_dir = "./"
修改为extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613"
并在此行后增加如下,然后保存:
extension = "soap.so"
重新启动apache
,ok
我们就已经能看到扩展的soap
模块了。
如果还要扩展别的模块可以一次类推,这里还有点要说明,如果做了zend
,php.ini
文件是在/usr/local/php/etc
下的,但是我们这边重新编译后,它回放到/usr/local/php/lib
下。所以这里要注意一下。
......
数据库是sqlserver2005,数据存储的具体编码不详. 到网上找了段转码函数 /* 定义字符转换函数,解决mssql中文乱码问题 */
function convert2utf8($string)
{
return iconv("gbk","utf-8",$string);
}
function convert2gbk($string)
{
return iconv("utf-8","gbk",$string);
} 解决中文乱码问题.但是不知道sqlserver 中有没有 类似 mysql中的 set names utf8 这种类似的语句..正在学习中... ......
数据库是sqlserver2005,数据存储的具体编码不详. 到网上找了段转码函数 /* 定义字符转换函数,解决mssql中文乱码问题 */
function convert2utf8($string)
{
return iconv("gbk","utf-8",$string);
}
function convert2gbk($string)
{
return iconv("utf-8","gbk",$string);
} 解决中文乱码问题.但是不知道sqlserver 中有没有 类似 mysql中的 set names utf8 这种类似的语句..正在学习中... ......