[PHP]实用函数9_php技巧
//执行输入 command 的外部程式或外部指令。返回 string 只是外部程式执行后传回的最后一行;若需要完整地返回信息,可以使用 PassThru()
string exec(string command,string [array],int [return_var])
//用来执行指令,并输出结果。若是 return_var 参数存在,则执行 command 之后的状态会填入 return_var 中
string system(string command,int [return_var]
//作为外部程序执行并显示原始输出
string passthru(string command,int [return_var])
//除去字串中的特殊符号
string escapeshellcmd(string command)
//用来锁住文件,使其他进程无法存取。传入的参数 fp 为文件指针。参数 operation 的值为下列的数字之一:1 表示设定锁住文件可以允许别的进程读取;2 表示只有该进程可以写入文件;3 表示读写均锁住;4 则不锁文件块(block)
bool flock(int fp,int operation)
//从文件中提取所有<meta>标志内容属性并返回一个数组
array get_meta_tags(string filename[,int use_include_path])
//把整个文件读入一个数组,每行作为一个数组元素
array file(void)
//创建一个可写的临时文件,当调用 fclose() 函数后或脚本结束时该文件被自动删除
array tmpfile(void)
//打开一个文件或 URL 并返回一个文件指针
int fopen(string filename,string mode)
//关闭一个打开的文件指针
int fclose(int fp)
//测试一个文件指针,看是否到了文件尾
int feof(int fp)
//利用文件指针获得一行
string fgets(int fp,int length)
//同 fgets() 的功能,并同时去掉取回字符串中的HTML语言及PHP语法的标记字符
string fgetss(int fp,int length)
//取得文件指针所指的字符。指针若在 EOF 则返回 false
string fgetc(int fp)
//将字符串 string 写入文件数据流的指针 fp 上。若有指定长度 length,则会写入长度的字符串,或是写到字符串结束
int fwrite(int fp,string string,int [lenth])
//强制向 fp 指向的文件进入写入操作
int fflush(int fp)
//把文件指针的位置移到文件开头
int rewind(int fp)
//返回文件 fp 的指针偏移位(offset)值。当发生错误时,返回 false
int ftell(int fp)
//将文件 fp 的指针移到指定的偏移位(offset)上。当 fp 由 fopen() 打开 http://... 或是 ftp://... 等URL文件时,本函数无效
int fseek(int fp,int offset)
//读取文件,并将文件内容写入标准输出设备中
int readfile(string filename)
//读取文件 fp 直到 EOF,并将数据输出到标准输出
int fpassthru(int fp)

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Alipay PHP...

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

Session hijacking can be achieved through the following steps: 1. Obtain the session ID, 2. Use the session ID, 3. Keep the session active. The methods to prevent session hijacking in PHP include: 1. Use the session_regenerate_id() function to regenerate the session ID, 2. Store session data through the database, 3. Ensure that all session data is transmitted through HTTPS.

The application of SOLID principle in PHP development includes: 1. Single responsibility principle (SRP): Each class is responsible for only one function. 2. Open and close principle (OCP): Changes are achieved through extension rather than modification. 3. Lisch's Substitution Principle (LSP): Subclasses can replace base classes without affecting program accuracy. 4. Interface isolation principle (ISP): Use fine-grained interfaces to avoid dependencies and unused methods. 5. Dependency inversion principle (DIP): High and low-level modules rely on abstraction and are implemented through dependency injection.

How to debug CLI mode in PHPStorm? When developing with PHPStorm, sometimes we need to debug PHP in command line interface (CLI) mode...

How to automatically set the permissions of unixsocket after the system restarts. Every time the system restarts, we need to execute the following command to modify the permissions of unixsocket: sudo...

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

Article discusses essential security features in frameworks to protect against vulnerabilities, including input validation, authentication, and regular updates.
