我的php的学习
<?
class upload{
private $name; //$_FILES['file'][name]
private $type; //$_FILES['file'][type]
private $tmp_name; //$_FILES['file'][tmp_name]
private $error; //$_FILES['file'][error]
private $size; //$_FILES['file'][size]
private $newf; //文件上传路径 默认为 upload/
public function __construct($name,$type,$tmp_name,$error,$size,$newf="upload/"){
$this->name=$name;
$this->type=$type;
$this->tmp_name=$tmp_name;
$this->error=$error;
$this->size=$size;
$this->newf=$newf;
}
private function size(){ //上传大小
if($this->size>(1024*1024)){ //默认为 1MB
echo "<script>alert('您上传文件太大了,不能上传!');history.back();</script>";
exit();
}
}
private function type(){ //支持上传类型
switch ($this->type)
{
case "image/pjpeg":
break;
case "image/gif":
break;
case "image/x-png":
break;
case "application/x-shockwave-flash": //swf
break;
case "text/plain": //text
break;
case "application/msword": //doc
break;
&nb
相关文档:
遍历目录文件,替换编码部分,删除原文件,再重新转码原文件内容,重新生成新文件。
function explorerdir($sDir){
static $aTempArr=array();
$dp=opendir($sDir);
while ($sFileName = readdir($dp)){
if ($sFileName !='.' && $sFileName !='..'){
......
Warning
: Illegal offset type in
Warning
: Illegal offset type in isset or
empty in
前几天写程序的时候碰到一个这种错误提示
如果你使用这样的表示方法如下:
$arr = array();
class a
{
}
$o = new a;
echo $arr[$o];
就会出现上面的错误提示,因为不能使用实例化的对象来作为数组的索引,或者在使用i ......
再次之前先说一个网址:https://www.paypaltech.com/SG2/
这个是生成paypal IPN的网址,这样说吧,是替你生成代码的网址(非常的好)!不懂没关系!先知道一下!
下载教程网址:http://download.csdn.net/source/2225766
http://download.cs ......
[转自]http://hi.baidu.com/xiamishule/blog/item/dea92c09ef9acc9e0b7b8236.html
源代码:
PHP获取IP的方法有许多种,<br />今天向大家总结了六种方法。
<br />PHP获取IP方法一:
<?php
function GetIP() {
if(!empty($_SERVER["HTTP_CLIENT_ ......