PHP文件的上传下载
一、文件的上传 1、客户端设置: (1)、在 标签中将enctype和method两个属性指明相应的值。&nb […]
一、文件的上传
1、客户端设置:
(1)、在
二、文件下载
简单文件下载只需要使用HTML的链接标记,并将属性href的URL值指定下载的文件即可。这种方法只能处理一些浏览器不能识别的MIME类型文件。
为了提高安全性,不希望在a标签中给出文件链接,则必须向浏览器发送必要的头信息,我们可以使用如下代码。
三、文件函数库
touch
设置文件的访问和修饰时间
bool touch(string $filename[, int $time[, int $time]])
copy
复制文件
bool copy(string $source, string $dest)
注意:移动文件请使用rename函数
file_put_contents
将一个字符串写入文件
int file_put_contents(string $filename, string $data[, int $flag[, resource $content]])
file_get_contents
将整个文件读到字符串
string file_get_contents(string $filename[, bool user_include_path [, resource $content[, int $offset[, int $maxlen]]]])
四、序列化与反序列化
serialize
序列化
string serialize(mixed $value)
注意:serialize()可处理除了resouce之外的任何类型。甚至可以serialize()那些包含了指向其自身引用的数组。
unserialize
反序列化
mixed unserialize(string $str)
● date
格式化一个本地时间/日期
string date(string format[, int timestamp]);
● getdate
取得日期/时间信息
array getdate([int timestamp]);
● microtime
返回当前Unix时间戳和微秒数
mixed microtime([bool get_as_float]);
● date_default_timezone_set
设置默认时区
bool date_default_timezone_set(string timezone_identifier);
● date_default_timezone_get
获取默认时区
string date_default_timezone_get(void);
三、字符函数库
strlen
获取字符串长度
int strlen(string $str);
strtolower
字符串转换为小写
string strtolower(string $str);
strtoupper
字符串转换为大写
string strtoupper(string $str);
ucfirst
首字母大写
string ucfirst(string $str);
ucwords
将每个单词的首字母转换为大写字母
string ucwords(string $str);
ltrim
从字符串开始的位置删除空格或其他字符
string ltrim(string $str [, string $charlist]);
rtrim
从字符串结束的位置删除空格或者其他字符
string rtrim(string $str[, string $chirlist]);
trim
从字符串开始和结束的位置删除空格或者其他字符
str_replace
字符替换
mixed str_ireplace(mixed $search, mixed $replace, mixed $subject, [int $count]);
str_ireplace
字符替换
mixed str_ireplace(mixed $search, mixed $replace, mixed $subject, [int $count]);
md5
计算字符串的MD5哈希
string md5(string $str[, bool $raw_output=false]);
strpos
返回一个字符在另一个字符第一次出现的位置
int strpos(string haystack, mixed needle[, int offset]);

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

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Dreamweaver CS6
Visual web development tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

SublimeText3 Chinese version
Chinese version, very easy to use
