php测试文件
PHP_File文件操作简单常用函数
php测试文件
header("Content-type:text/html;charest=utf-8");
$fileDir='Upload/File/content.txt';
echo '文件路径:'.$fileDir.'
';
echo '路径目录|dirname():'.dirname($fileDir).'
';
echo '路径文件名|basename():'.basename($fileDir).'
';
echo '文件类型|filetype():'.filetype($fileDir).'
';
echo '文件大小|filesize():'.filesize($fileDir).'
';
echo '文件修改时间|filemtime():'.filemtime($fileDir).'
';
echo '
';
echo '绝对路径|realpath():'.realpath($fileDir).'
';
echo '以数组形式返回路径信息|pathinfo():
';
print_r(pathinfo($fileDir));echo '
';
echo '
';
echo '复制并重命名文件|rename(url01,url02):返回'.copy($fileDir,'./Upload/renameContent.txt').'
';
echo '复制文件|copy(url01,url02):返回'.copy($fileDir,'./Upload/copyContent.txt').'
';
echo '删除文件|unlink(url):返回'.@unlink('./Upload/unlinkContent.txt').'
';
echo '
';
echo '将文件信息以字符串形式读取出来|file_get_contents(url):
';
echo file_get_contents($fileDir).'
';
$putContent='hello word!';
echo '将字符串写入文件,文件不存在自动创建,目录必须存在,|file_put_contents(url,str)返回文件大小:';
echo file_put_contents('./Upload/file_put_contents.txt',$putContent).'
';
?>
php返回结果
文件路径:Upload/File/content.txt
路径目录|dirname():Upload/File
路径文件名|basename():content.txt
文件类型|filetype():file
文件大小|filesize():27
文件修改时间|filemtime():1411488282
绝对路径|realpath():D:\Kuaipan\www\TestPhp\Upload\File\content.txt
以数组形式返回路径信息|pathinfo():
Array ( [dirname] => Upload/File [basename] => content.txt [extension] => txt [filename] => content )
复制并重命名文件|rename(url01,url02):返回1
复制文件|copy(url01,url02):返回1
删除文件|unlink(url):返回
将文件信息以字符串形式读取出来|file_get_contents(url):
hello word! bad word!!!
将字符串写入文件,文件不存在自动创建,目录必须存在,|file_put_contents(url,str)返回文件大小:11

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

AI Hentai Generator
Generate AI Hentai for free.

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

Many users will choose the Huawei brand when choosing smart watches. Among them, Huawei GT3pro and GT4 are very popular choices. Many users are curious about the difference between Huawei GT3pro and GT4. Let’s introduce the two to you. . What are the differences between Huawei GT3pro and GT4? 1. Appearance GT4: 46mm and 41mm, the material is glass mirror + stainless steel body + high-resolution fiber back shell. GT3pro: 46.6mm and 42.9mm, the material is sapphire glass + titanium body/ceramic body + ceramic back shell 2. Healthy GT4: Using the latest Huawei Truseen5.5+ algorithm, the results will be more accurate. GT3pro: Added ECG electrocardiogram and blood vessel and safety

To learn more about open source, please visit: 51CTO Hongmeng Developer Community https://ost.51cto.com Running environment DAYU200:4.0.10.16SDK: 4.0.10.15IDE: 4.0.600 1. To create an application, click File- >newFile->CreateProgect. Select template: [OpenHarmony] EmptyAbility: Fill in the project name, shici, application package name com.nut.shici, and application storage location XXX (no Chinese, special characters, or spaces). CompileSDK10, Model: Stage. Device

Use Java's File.length() function to get the size of a file. File size is a very common requirement when dealing with file operations. Java provides a very convenient way to get the size of a file, that is, using the length() method of the File class. . This article will introduce how to use this method to get the size of a file and give corresponding code examples. First, we need to create a File object to represent the file we want to get the size of. Here is how to create a File object: Filef

How to convert php blob to file: 1. Create a php sample file; 2. Through "function blobToFile(blob) {return new File([blob], 'screenshot.png', { type: 'image/jpeg' })} ” method can be used to convert Blob to File.

Use Java's File.renameTo() function to rename files. In Java programming, we often need to rename files. Java provides the File class to handle file operations, and its renameTo() function can easily rename files. This article will introduce how to use Java's File.renameTo() function to rename files and provide corresponding code examples. The File.renameTo() function is a method of the File class.

Why Snipping Tool Not Working on Windows 11 Understanding the root cause of the problem can help find the right solution. Here are the top reasons why the Snipping Tool might not be working properly: Focus Assistant is On: This prevents the Snipping Tool from opening. Corrupted application: If the snipping tool crashes on launch, it might be corrupted. Outdated graphics drivers: Incompatible drivers may interfere with the snipping tool. Interference from other applications: Other running applications may conflict with the Snipping Tool. Certificate has expired: An error during the upgrade process may cause this issu simple solution. These are suitable for most users and do not require any special technical knowledge. 1. Update Windows and Microsoft Store apps

Use java's File.getParentFile() function to get the parent directory of a file. In Java programming, we often need to operate files and folders. When we need to get the parent directory of a file, we can use the File.getParentFile() function provided by Java. This article explains how to use this function and provides code examples. File class in Java is the main class used to operate files and folders. It provides many methods to obtain and manipulate file properties

In today's era of rapid technological development, programming languages are springing up like mushrooms after a rain. One of the languages that has attracted much attention is the Go language, which is loved by many developers for its simplicity, efficiency, concurrency safety and other features. The Go language is known for its strong ecosystem with many excellent open source projects. This article will introduce five selected Go language open source projects and lead readers to explore the world of Go language open source projects. KubernetesKubernetes is an open source container orchestration engine for automated
