以下是一个简单的PHP实例,演示如何从本地文件系统中读取文件内容。
```php
// 定义文件路径
$filePath = 'example.txt';
// 检查文件是否存在
if (file_exists($filePath)) {
// 读取文件内容
$fileContent = file_get_contents($filePath);
// 输出文件内容
echo "
以下是一个简单的PHP实例,演示如何从本地文件系统中读取文件内容。
```php
// 定义文件路径
$filePath = 'example.txt';
// 检查文件是否存在
if (file_exists($filePath)) {
// 读取文件内容
$fileContent = file_get_contents($filePath);
// 输出文件内容
echo "