[PHP]实用函数6第1/2页

2019-11-17,,

//寄出电子邮件到指定的邮件地址 to,subject 表示主题,message 为信件内容。额外的选项 additional_headers 可省略,表示其他邮件文档首部

bool mail(string to,string subject,string message,string [additional——headers]
//将 URL 字符串予以解析,并将结果返回数组中。返回的数组包括下列元素:scheme、host、port、path、query 与 fragment 等

array parse_url(string url)
//将字符串以 URL 编码,例如空格就会变成加号。网页中表单数据传送就是用 urlencode 编码后再送出

string urlencode(string str)
//将 URL 编码后字符串还原

string urldecode(string str)
//可打开 FTP 服务器的链接。参数 host 为 FTP 服务器的网址。参数 port 通常省略,若 FTP 服务器的端口号(port)不是21时才需要加本参数。若无错误则返回连接代码,失败则返回 false

int ftp_connect(string host,int [port])
//可登入链接的 FTP 服务器。参数 ftp_stream 和 password 为 FTP 服务器的使用者帐号及密码,通常 anonymous 为公开的使用帐号,密码则为某个电子邮件地址。成功则返回 true

bool ftp_login(int ftp_stream,string username,string password)
//用来取得目前在 FTP 服务器中的路径。参数 ftp_stream 为 FTP 的连接代码。若有错误则返回 NULL

string ftp_pwd(int ftp_stream)
//用来回到上层目录,也就是目前目录的父目录。参数 ftp_stream 为 FTP 连接代码。成功则返回 true

boolean ftp_cdup(int ftp_stream)
//用来前往下一层目录。参数 ftp_stream 为 FTP 的连接代码。参数 directory 为欲前往的目录。成功返回 true,失败则返回 false

bool ftp_chdir(int ftp_stream,string directory)
//返回给定目录的文件名或数组

array ftp_nlist(int ftp_stream,string directory)
//按输出行数组的方式返回某个目录的详细清单

array ftp_rawlist(int ftp_stream,string directory)
//可显示远端 FTP 服务器的系统,也就是等于对 FTP 服务器下 system 或 syst 指令。成功则返回字符串,如“215 UNIX Type: L8”,失败则返回 false

string ftp_systype(int ftp_stream)
//用来下载指定的文件。参数 ftp_stream 为 FTP 的连接代码;参数 local_file 为欲存在本地端的文件名;参数 remote_file 为欲下载的文件名;参数 mode 的值有 FTP_ASCII 及 FTP_BINARY 二种,分别表示文本文件或者是二进制文件,成功则返回 true,失败则返回 false

bool ftp_get(int ftp_stream,string local_file,string remote_file,int mode)
//下载文件,并存在已打开的本地文件中。参数 fp 为本地端的已打开文件的文件指针

bool ftp_fget(int ftp_stream,int fp,string remote_file,int mode)
//用来上传指定的文件。参数 ftp_stream 为 FTP 的连接代码;参数 remote_file 为欲存在远端的文件名;参数 local_file 为欲上传的文件名;参数 mode 的值有 FTP_ASCII 及 FTP_BINARY 二种

bool ftp_put(int ftp_stream,string remote_file,string local_file,int mode)
//向 FTP 主机发送 cmd 命令,该命令不是标准化,而是与服务器的主机操作系统有关,可用于文件的访问许可、组成员的操作

bool ftp_site(resource ftp_stream,string cmd)
//关闭 FTP 连接

bool ftp_quit(int ftp_stream)
//可传回某个IP网址的主机域名。若执行失败,则传回原来的IP网址

string gethostbyaddr(string ip_address)
//可传回某个网络主机的IP网址。若执行失败,则传回原来的计算机域名hostname

string gethostbyname(string hostname)
//返回给定主机的IP地址列表

array gethostbynamel(string hostname)
//检查给定的因特网主机名或IP地址是否存在DNS记录,type 可以是 A、MX、NS、SOA、TPR、CNAME 或 ANY,默认类型为 MX

int checkdnsrr(string host [,stringtype])
//获得相应于给定因特网主机名的 MX 记录

12下一页阅读全文

《[PHP]实用函数6第1/2页.doc》

下载本文的Word格式文档,以方便收藏与打印。