以下是一个使用PHP读取硬盘上文件内容的实例。这个例子中,我们将读取一个名为`example.txt`的文本文件,并将内容输出到浏览器。
```php

// 定义文件路径
$filePath = 'example.txt';
// 检查文件是否存在
if (file_exists($filePath)) {
// 读取文件内容
$fileContent = file_get_contents($filePath);
// 输出文件内容
echo "
以下是一个使用PHP读取硬盘上文件内容的实例。这个例子中,我们将读取一个名为`example.txt`的文本文件,并将内容输出到浏览器。
```php

// 定义文件路径
$filePath = 'example.txt';
// 检查文件是否存在
if (file_exists($filePath)) {
// 读取文件内容
$fileContent = file_get_contents($filePath);
// 输出文件内容
echo "