php常用的基本函数
php的函数分为系统函数,用户函数
1,php函数不区分大小写
函数原型:
返回类型 函数名称(类型 参数)
2.1,系统函数中常用的数学函数
abs(eumber) 去绝对值
sin(float) 正弦计算sin(x)
cos(float) 余弦计算cos(x)
log(float) 自然对数计算
sqrt(float) 开平方根计算
log10(float) 10基底的对数
exp(float) 自然对数e的次方值
pow(float x,float y) 次方x的y次方
pi() 圆周率
rand([min],[max]) 取随机数
2.2 字符串函数
strtolower() 字符串转为小写
strtoupper() 字符串转为大写
trim() 截去字符串首尾空格
substr(string,start,[length]) 取子串
strlen(string str) 取得字符串长度
strpos(母串,待查字符,[offset]) 寻找字符串中某字符最先出现处
strcmp(str1,str2) 字符串比较
2.3 文件系统函数:
int filesize(string filename) 获得文件大小
int feof(int fp) 测试文件指针是否指到文件尾
int fopen(string filename,string mode) 打开文件或者URL
int fclose(int fp) 关闭已打开的文件
string fread(int fp,int n) 读取文件N个字节
string fgets(int fp,int n) 取得文件指针所指的行(适合大文件处理)
int fwrite(int fp,string string,int[n]) 写入文件
int fputs(int fp,string str,int[n]) 写入文件
int mkdir(string pathname,int mode) 建立目录
int rmdir(string dirname) 删除目录
int rename(string oldname,string newname) 改名
2.4 网络函数:
int fsockopen(string hostname,int port,int[errno],string[errstr],int
[timeout]) 打开网络socket链接
string gethostbyname(string hostname) DNS查询,返回IP网址
array gethostbynamel(string hostname) 返回机器名称的所有IP
2.5 MySQL数据库函数:
int mysql_connect(string[hostnam
相关文档:
最近帮实验室完善一个CMS系统,现在已经进入尾声,借此机会简要记录一下实现的细节,以备所需。
本系统是个纯粹的在线内容管理系统,最主要的操作就是向数据库中添加、修改和删除数据,应该说实现起来很简单,不过正是因为简单,使得原有系统显得很难维护,简单类似的操作有20多个不同的页面,每个页面 ......
When I deploy php application on apache, some problem come out, and solved. Here's the tips and problems solved.
0.How could I deploy an apache server armed with php, mysql, perl, and phpMyAdmin on the fly?
You need a package bundled with all these tools, xampp shall meet you needs, you can ......
1.基本类
//smarty_config.php
<?php
define('TEMPLATE_DIR','templates/');
define('COMPILE_DIR','templates_c/');
define('CONFIG_DIR','configs/');
define('CACHE_DIR','cache/');
?>
//View.class.php
<?php
//配置文件
require_once 'configs/smart_config.php';
//Smarty类
require('smarty/ ......
说明:
1、本文档是为初学PHP的朋友而制作的。
2、看了本文档学会PHP的朋友,请反馈你对本文档的意见或建议(发邮件到kuaiyigang@163.com或在QQ群4798654中提出),以帮助更多的初学者。
1、php语言的概述及开发环境的配置(1天)
a、php发展及应用介绍(了解)
b、php及相关软件在类linux和windows的具体安装步骤 (初 ......
php中DIRECTORY_SEPARATOR 与 PATH_SEPARATOR的区别
DIRECTORY_SEPARATOR:路径分隔符,linux上就是’/’ windows上是’\’
PATH_SEPARATOR:include多个路径使用,在win下,当你要include多个路径的话,你要用”;”隔开,但在linux下就使用”:”隔开的。
这2个常 ......