php 学习笔记 5
来源:互联网 发布:数据库前置库 编辑:程序博客网 时间:2024/06/08 08:48
13.2 目录处理
1.打开目录
resource opendir(string dir)
2.关闭目录
void closedir(resource handle)
13.2.2浏览目录
array scandir(string directory[,int sorting_order])
返回数组
13.2.3 操作目录
新建目录 mkdir(stirng pathname)
删除目录 rmdir(string pathname)
string getcwd(void) 取得当前的工作目录
bool chdir(string directory) 改变当前目录为
float disk_total_space(string directory) 返回目录的总空间大小
string readdir(resource handle) 返回目录中下一个文件的文件名 此目录必须是童工opendir打开的
void rewinddir(resource handle) 将制定的目录重新指定到目录的开头
13.3 文件处理的高级应用
13.3.1 远程文件访问
13.3.2 文件指针
1.rewind(resource handle)
将文件指针 设置为 文件流的 开头
2.fseek()函数
int fseek(resource handle,int offset[,int whence])
3.bool feof(resource handle)
4.int ftell(resource handle)函数返回当前指针的位置
13.3.3 锁定文件
bool flock(int handle,nt operation)
13.4 文件上传
move_uploaded_file()
13.4.2 预定义变量 $_FILES
$_FILES[filename][name]上传文件名
$_FILES[filename][size]大小 单位字节
$_FILES[filename][tmp_name] 临时文件名
$_FILES[filename][type] 类型
$_FILES[filename][error] 返回0表示成功
13.4.3 文件上传函数
bool move_uploaded_file(string filename,string destination)
以下是一个简单地文件上传
index.php
<?php
echo "<br>-------------------------------------------------<br>";
?>
<p> upload </p>
<form action="index_ok.php" method="post" enctype="multipart/form-data">
<table width="500" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="150" height="30" align="right" valign="middle">请选择上传文件:</td>
<td width="250"><input type="file" name="up_file"/></td>
<td width="100"><input type="submit" name="submit" value="上传"/></td>
</tr>
</table>
</form>
index_ok.php
<?PHP
if(!empty($_FILES['up_file']['name']))
{
$fileinfo=$_FILES['up_file'];
if($fileinfo['size']<1000000 && $fileinfo['size']>0)
{
move_uploaded_file($fileinfo['tmp_name'],'./uploads/'.$fileinfo['name']);
echo '上传成功';
}
else{echo '文件大小不对';}
}
else{ echo ' 啊呀,没文件那 !.';}
?>
13.4.4 多文件上传
只需在表单中对文件上传域使用数组命名计科
<input name="up_file[]" type="file">
文件上传就这么多..
-------------------------------------------
14 类
14.1 php类
<?php
class SportObject{
public $name;
public $height;
public $avoirdupois;
const NOVARIABLE='常量';//常量 使用时 不需要实例化
function fun($a,$b)
{
something;
}
void __construct([mixed args]){};//构造方法
void __destruct(void);//析构方法
}
$duixiang=new SportObject();//类的实例化
$duixiang->fun('1','2');//调用成员方法
?>
14.2.7 继承和多态
class subClass extends superClass()
{
}
14.2.8 $this-> ::
parent可以调用父类中的成员变量 成员方法 常量
self 调用当前类中的静态成员和常量
14.2.9 数据隐藏
public pricate protected
14.3 PHP对象的高级应用
14.3.1 final关键字
14.3.2 抽象类 abstract
14.3.3 interface{}
14.3.4 克隆对象
14.3.5 对象比较
14.3.6 对象类型检测
ObjectName instanceof ClassName
14.3.7 魔术方法
面向对象暂时不了解太多. 有过c++ 和java的基础 对前半部分理解起来还不算问题.
---------------------------
15.php加密技术
15.1.1 crypt()
string crypt)string str[,string salt])
15.1..2 MD5
stirng md5(stirng str[,bool raw_output]);
15.1.3 sha1()
string sha1(string str[,bool raw_output]);
等以后学了密码学再仔细看看...
16.MySQL数据库基础
16.2.1 启动MySQL数据库
16.*.*'
我学过数据库 基本的操作还是了解的...
16.6.1 数据库备份
mysqldump -uroot -proot db_database>F:\db.txt
16.6.2 数据库恢复
mysql -uroot -proot db_database<F:\db.txt
17 phpMyAdmin
貌似很好用的样子 我还是用命令行吧
18 PHP+MYSQL
18.2.1 mysql_connect()
mysql_connect('hostname','username','password');
18.2.2 mysql_select_db()
mysql_connect(string db_name[,resource link_identifier])
or
mysql_query("use db_name"[,resource link_identifier]);
18.2.3 mysql_query() 函数执行SQL语句
mysql_query(string query[,resource link_identifier);
他是查询指令的专用函数 所有的sql语句都可以通过它执行 并返回结果集
18.2.4 使用mysql_fetch_array()函数 从 数组结果集中 获取信息
array mysql_fetch_array(resource result[,int result_type])
18.2.5 mysql_fetch_object()函数从结果集中获取一行作为对象
18.2.6
mysql_fetch_row()函数逐行获取结果集中的每条记录
array mysql_fetch_row(resource result)
18.2.7 获取查询结果集中的
mysql_num_rows();
18.3 PHP操作MySQL数据库
--------------------------------------
第19章 ADODB 类库
Active Data Objects Data Base
......我自动忽略了...表怪我
1.打开目录
resource opendir(string dir)
2.关闭目录
void closedir(resource handle)
13.2.2浏览目录
array scandir(string directory[,int sorting_order])
返回数组
13.2.3 操作目录
新建目录 mkdir(stirng pathname)
删除目录 rmdir(string pathname)
string getcwd(void) 取得当前的工作目录
bool chdir(string directory) 改变当前目录为
float disk_total_space(string directory) 返回目录的总空间大小
string readdir(resource handle) 返回目录中下一个文件的文件名 此目录必须是童工opendir打开的
void rewinddir(resource handle) 将制定的目录重新指定到目录的开头
13.3 文件处理的高级应用
13.3.1 远程文件访问
13.3.2 文件指针
1.rewind(resource handle)
将文件指针 设置为 文件流的 开头
2.fseek()函数
int fseek(resource handle,int offset[,int whence])
3.bool feof(resource handle)
4.int ftell(resource handle)函数返回当前指针的位置
13.3.3 锁定文件
bool flock(int handle,nt operation)
13.4 文件上传
move_uploaded_file()
13.4.2 预定义变量 $_FILES
$_FILES[filename][name]上传文件名
$_FILES[filename][size]大小 单位字节
$_FILES[filename][tmp_name] 临时文件名
$_FILES[filename][type] 类型
$_FILES[filename][error] 返回0表示成功
13.4.3 文件上传函数
bool move_uploaded_file(string filename,string destination)
以下是一个简单地文件上传
index.php
<?php
echo "<br>-------------------------------------------------<br>";
?>
<p> upload </p>
<form action="index_ok.php" method="post" enctype="multipart/form-data">
<table width="500" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="150" height="30" align="right" valign="middle">请选择上传文件:</td>
<td width="250"><input type="file" name="up_file"/></td>
<td width="100"><input type="submit" name="submit" value="上传"/></td>
</tr>
</table>
</form>
index_ok.php
<?PHP
if(!empty($_FILES['up_file']['name']))
{
$fileinfo=$_FILES['up_file'];
if($fileinfo['size']<1000000 && $fileinfo['size']>0)
{
move_uploaded_file($fileinfo['tmp_name'],'./uploads/'.$fileinfo['name']);
echo '上传成功';
}
else{echo '文件大小不对';}
}
else{ echo ' 啊呀,没文件那 !.';}
?>
13.4.4 多文件上传
只需在表单中对文件上传域使用数组命名计科
<input name="up_file[]" type="file">
文件上传就这么多..
-------------------------------------------
14 类
14.1 php类
<?php
class SportObject{
public $name;
public $height;
public $avoirdupois;
const NOVARIABLE='常量';//常量 使用时 不需要实例化
function fun($a,$b)
{
something;
}
void __construct([mixed args]){};//构造方法
void __destruct(void);//析构方法
}
$duixiang=new SportObject();//类的实例化
$duixiang->fun('1','2');//调用成员方法
?>
14.2.7 继承和多态
class subClass extends superClass()
{
}
14.2.8 $this-> ::
parent可以调用父类中的成员变量 成员方法 常量
self 调用当前类中的静态成员和常量
14.2.9 数据隐藏
public pricate protected
14.3 PHP对象的高级应用
14.3.1 final关键字
14.3.2 抽象类 abstract
14.3.3 interface{}
14.3.4 克隆对象
14.3.5 对象比较
14.3.6 对象类型检测
ObjectName instanceof ClassName
14.3.7 魔术方法
面向对象暂时不了解太多. 有过c++ 和java的基础 对前半部分理解起来还不算问题.
---------------------------
15.php加密技术
15.1.1 crypt()
string crypt)string str[,string salt])
15.1..2 MD5
stirng md5(stirng str[,bool raw_output]);
15.1.3 sha1()
string sha1(string str[,bool raw_output]);
等以后学了密码学再仔细看看...
16.MySQL数据库基础
16.2.1 启动MySQL数据库
16.*.*'
我学过数据库 基本的操作还是了解的...
16.6.1 数据库备份
mysqldump -uroot -proot db_database>F:\db.txt
16.6.2 数据库恢复
mysql -uroot -proot db_database<F:\db.txt
17 phpMyAdmin
貌似很好用的样子 我还是用命令行吧
18 PHP+MYSQL
18.2.1 mysql_connect()
mysql_connect('hostname','username','password');
18.2.2 mysql_select_db()
mysql_connect(string db_name[,resource link_identifier])
or
mysql_query("use db_name"[,resource link_identifier]);
18.2.3 mysql_query() 函数执行SQL语句
mysql_query(string query[,resource link_identifier);
他是查询指令的专用函数 所有的sql语句都可以通过它执行 并返回结果集
18.2.4 使用mysql_fetch_array()函数 从 数组结果集中 获取信息
array mysql_fetch_array(resource result[,int result_type])
18.2.5 mysql_fetch_object()函数从结果集中获取一行作为对象
18.2.6
mysql_fetch_row()函数逐行获取结果集中的每条记录
array mysql_fetch_row(resource result)
18.2.7 获取查询结果集中的
mysql_num_rows();
18.3 PHP操作MySQL数据库
--------------------------------------
第19章 ADODB 类库
Active Data Objects Data Base
......我自动忽略了...表怪我
0 0
- php 学习笔记 5
- PHP学习笔记5:常量
- Think PHP 5学习笔记
- php学习笔记--php基础
- PHP学习笔记 -- 初识PHP
- php学习笔记5—(文件操作)
- PHP学习笔记5(结构语句)
- PHP学习笔记(一)
- php学习笔记:NULL
- PHP学习笔记
- Php 学习笔记
- php学习笔记-02
- php学习笔记-03
- php学习笔记-04
- PHP学习笔记-05
- PHP学习笔记
- 一周php学习笔记
- php学习笔记
- LoadLibraryEx(DONT_RESOLVE_DLL_REFERENCES) is fundamentally flawed
- web.xml 配置 Error Page
- Leetcode_Add Binary
- poj2056
- Pinterest用“引导式搜索”挑战谷歌?
- php 学习笔记 5
- 命令模式(CommandPattern)
- 机器学习-回归及分类问题总结
- Surprising Strings(STL)
- OC中的方法
- Acdream 1148 GCD SUM 莫比乌斯
- 对排序的总结&&二分查找
- Leetcode_Remove Duplicates from Sorted Array II
- HDU 4355 Party All the Time (三分算法的应用(含三分算法的讲解))