这是我在学习php过程中做的笔记,为了可以有一个良好的学习习惯,也为了给广大的编程爱好者一个学习的参考,特把学习笔记分享出来,希望对自己和大家都有帮助。本学习资料主要来自于LAMP兄弟连的细说PHP,PHP5中文手册和网上资料,强烈推荐有志于学习PHP的朋友选择LAMP兄弟连的《细说PHP》
文件判断函数
is_dir()
is_executable() 判断是否是可执行文件
is_file()
is_link() 判断文件名是否为一个符号连接
is_readable()
is_uploader_fiel() 判断文件是否通过HTTP POST上传
is_writable()
文件属性
file_exists()
filesize()
is_readable()
is_writeable()
filectime()
filemtime()
取文件名 basename()
取目录 dirname()
文件路径信息 pathinfo()
创建文件 touch($file)
删除文件 unlink($file)
移动文件(重命名文件) rename(“当前文件路径","目标文件路径")
复制文件 copy(“文件名",”路径")
读写文件
file_get_contents()
file_put_contents()
fopen(“URL”,模式)
各种模式:
r: 只读模式打开文件 r+:读写模式 w: 只写模式打开,若文件不存在,则新建,若文件已有内容,则覆盖 w+ :读写模式 a: 只写模式打开,若文件不存在,则新建,若文件已有内容,则追加 a+:读写模式 b :以二进制模式打开文件(图片,视频) t :以文本模式打开文件fread() //读取指定长度的字符;fread(“$file”,filesize(“text.txt”))
fgetc() //一次从文件中读取一个字符;
fgets() //一次从文件中读取一行字符;
feof($file) //读取文件出错或到文件结束则返回真
写入文件
fwrite()
文件内部移动指针
ftell($file) //返回当前指针位置
fseek($file,100,常量) //移动文件指针
rewind()
basename(文件路径[,文件后缀名]) 获取文件名,第二个参数为获取文件基本名称 pathinfo(文件路径) 分析当前路径,返回一个关联数组,通过dirname,basename,extension来引用 realpath(文件相对路径) 显示文件绝对路径 filesize($file) 计算文件大小 fileatime($file) 显示最后一次被访问的时间 filectime($file) 文件建立时间 filemtime($file) 文件最后一个更新 fileperms() 返回文件属性以及权限 fileowner() 取得文件所有者
目录操作:
opendir() readdir() closedir() rewinddir() //指针返回第一个目录
The article discusses PHP, detailing its full form, main uses in web development, comparison with Python and Java, and its ease of learning for beginners.

PHP handles form data using $\_POST and $\_GET superglobals, with security ensured through validation, sanitization, and secure database interactions.

The article compares PHP and ASP.NET, focusing on their suitability for large-scale web applications, performance differences, and security features. Both are viable for large projects, but PHP is open-source and platform-independent, while ASP.NET,

PHP's case sensitivity varies: functions are insensitive, while variables and classes are sensitive. Best practices include consistent naming and using case-insensitive functions for comparisons.

The article discusses various methods for page redirection in PHP, focusing on the header() function and addressing common issues like "headers already sent" errors.

Article discusses type hinting in PHP, a feature for specifying expected data types in functions. Main issue is improving code quality and readability through type enforcement.

The article discusses PHP Data Objects (PDO), an extension for database access in PHP. It highlights PDO's role in enhancing security through prepared statements and its benefits over MySQLi, including database abstraction and better error handling.

Article discusses creating and securing PHP APIs, detailing steps from endpoint definition to performance optimization using frameworks like Laravel and best security practices.


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

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

Zend Studio 13.0.1
Powerful PHP integrated development environment

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 English version
Recommended: Win version, supports code prompts!
