在 PHPStudy 中打开网页需要确保服务已启动,并通过浏览器访问本地或虚拟主机配置的站点。以下是详细步骤:
Apache/Nginx
(Web服务器)和 MySQL
(数据库)。
8080
),按需调整即可。C:\phpstudy_pro\WWW\
index.html
或 index.php
)放入此目录。http://localhost
http://localhost:8080
test.com
)、选择根目录、设置端口(如80)。C:\Windows\System32\drivers\etc\hosts
),添加一行:
127.0.0.1 test.com
http://test.com
端口冲突:
8080
)。文件路径错误:
WWW
目录下,且文件名是 index.php
或 index.html
。403 禁止访问:
Require all granted
(文件路径:phpstudy_pro\Extensions\Apache2.4.39\conf\httpd.conf
)。数据库连接问题:
localhost:3306
)。WWW
目录下新建 test.php
文件,内容:
php
<?php phpinfo(); ?>
http://localhost/test.php
通过以上步骤,你应该能顺利在 PHPStudy 中打开网页。如果仍有问题,请提供具体错误信息进一步排查!