php文件上传类
<?php
/**
* PHP100.com - 个人感觉非常简单,只要有点PHP基础滴人都应该能看懂~~
* Apache2 + PHP5.0
* Version:1.0
* 同时感谢PHP100所有的兄弟们
* ————————————————————————————————— Example —
* test.php @ 处理表单文件名
* <?php
*
* include("upload.php"); # 加入类文件
* $f_upload = new upload_other; # 创建对象
* $f_upload->set_file_type($_FILES['src']['type']); # 获得文件类型
* $f_upload->set_file_name($_FILES['src']['name']); # 获得文件名称
* $f_upload->set_file_size($_FILES['src']['size']); # 获得文件尺寸
* $f_upload->set_upfile($_FILES['src']['tmp_name']); # 服务端储存的临时文件名
* $f_upload->set_size(100); # 设置最大上传KB数
* $f_upload->set_base_directory("uploadImages"); # 文件存储根目录名称
* $f_upload->set_url("up.php"); # 文件上传成功后跳转的文件
* $f_upload->save(); # 保存文件
*
* ?>
* —————————————————————————————————— End —
*
* 偶没有
相关文档:
header()函数用来转向(redirect page)时,如果调用前有输出,比如echo或html标签,就会转向失败。
如果调用前有空行也会转向失败。
还有一个原因,就是注意你的php文件的字符编码。我遇到的情况是,当字符编码为UTF-8时,转向失败,改为ANSI时成功。具体原因不明,仅供参考。 ......
该程序没有优化 只是最原始的程序 可以将其与flash结合起来!
与flash结合起来就是将php得到的地址和区域 打印出来再返回个flash端这么简单
<?php
$getIP="218.11.140.23"; // 这里是自己随便写的一个ip 实际时你还要通过程序得到这个ip
//只开始时查前三段
$subIPs=explode(".",$getIP);
$subIP=$sub ......
Floating point precision
It is typical that simple decimal fractions like 0.1
or
0.7
cannot be converted into their internal binary
counterparts without a small loss of precision. This can lead to
confusing
results: for example, floor((0.1+0.7)*10)
will usually
return 7
......
用PHP实现进度条效果。
<?php
set_time_limit(0);
echo '<h2>正在安装,请稍后...</h2>',
'<div style="border:1px solid #000;width:500px;"><div id="progress_bar">loading...</div></div>';
for($i=1;$i<=100;$i++){
$width = '500';
......
文件php.ini放入windows下,将下面内容拷贝到记事本命名为php.ini放入c:/windows下,重启Apache server:
[PHP]
;;;;;;;;;;;
; WARNING ;
;;;;;;;;;;;
; This is the default settings file for new PHP installations.
; By default, PHP installs itself with a configuration suitable for
; development purposes ......