PHP 总结

目录

PHP函数

highlight_file() 函数:

public private protected 变量 

Is_Valid函数

is_numeric()函数

escapeshellarg()函数

escapeshellcmd()函数

scandir()函数

localeconv()函数

current()函数

 array_reverse() 函数

file_get_contents() 函数

preg_replace() 函数

strpos() 函数

intval() 函数

unserialize() 函数

preg_match() 函数

ctype_alpha()函数

PHP glob() 函数


PHP函数

  • highlight_file() 函数:

 

  1. 语法:highlight_file(filename,return)
  2. 作用:将 filename 中的代码按照 php 语法高亮程序中定义的颜色 输出或返回
  • public private protected 变量 

  1. public 表示全局,类内部外部子类都可以访问;
  2. private表示私有的,只有本类内部可以使用;
  3. protected表示受保护的,只有本类或子类或父类中可以访问;
  • Is_Valid函数

  1. 语法:Is_Valid(objectname)
  2. 参数:objectname:要检查的对象名。
  3. 作用:检查对象变量是否已经实例化,即实例变量的值是否是个有效的对象。
  • is_numeric()函数

  1. 语法:bool is_numeric ( mixed $var )
  2. 参数:$var:要检测的变量。
  3. 作用:判断是否为数字和数字字符串,如果是返回true,否则返回false。
  • escapeshellarg()函数

  1. 语法:escapeshellarg ( string $arg ) 
  2. 参数:$arg 需要被转码的参数。
  3. 作用:将给字符串增加一个单引号并且能引用或者转码任何已经存在的单引号, 这样以确保能够直接将一个字符串传入 shell 函数
  • escapeshellcmd()函数

  1. 语法:escapeshellcmd ( string $command ) 
  2. 参数:$command 要转义的命令。 
  3. 作用:对字符串中可能会欺骗 shell 命令执行任意命令的字符进行转义。
  • scandir()函数

  1. 语法:scandir(directory,sorting_order,context);
  2. 参数: 
  3. 作用:scandir() 函数返回指定目录中的文件和目录的数组。
  • localeconv()函数

  1. 语法:localeconv()
  2. 定义和用法: 
  • current()函数

  1. 语法:current(array)

  2. 参数:array 必需。规定要使用的数组。

定义和用法:

  •  array_reverse() 函数

  1. 语法:array_reverse(array,preserve)
  2. 参数: 
  3. 作用:
  • file_get_contents() 函数

  1. 语法:file_get_contents(path,include_path,context,start,max_length)
  2. 参数:
  3. 作用:
  • preg_replace() 函数

  1. 语法:mixed preg_replace ( mixed $pattern , mixed $replacement , mixed $subject [, int $limit = -1 [, int &$count ]] )
  2. 参数:
  3. 作用:preg_replace 函数执行一个正则表达式的搜索和替换。 
  • strpos() 函数

  1. 语法:strpos(string,find,start)
  2. 参数:
  3. 作用:
  • intval() 函数

  1. 语法:int intval ( mixed $var [, int $base = 10 ] )
  2. 参数:
  3. 作用:
  • unserialize() 函数

  1. 语法:mixed unserialize ( string $str )

  2. 参数:

  3. 作用:

  • preg_match() 函数

  1. 语法:int preg_match ( string $pattern , string $subject [, array &$matches [, int $flags = 0 [, int $offset = 0 ]]] )

  2. 参数:

  3. 作用:在  subject 字符串中搜索与 pattern给出的正则表达式相匹配的内容。

  • ctype_alpha()函数

  1. 语法:ctype_alpha ( string $text ) : bool
  2. 参数:text被测试的字符串
  3. 作用:如果在当前语言环境中 text 里的每个字符都是一个字母,那么就返回true,反之则返回false
  • PHP glob() 函数

  1. 语法:glob(pattern,flags)
  2. 参数:
  3. 作用:glob() 函数返回匹配指定模式的文件名或目录。
  4. 用法举例:glob("*") 匹配任意文件,glob("*.txt")匹配以txt为后缀的文件
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值