Nothing appears in the browser when I open this file. I assumed it's supposed to show "it works," but instead it shows nothing when the file is opened in the browser.
<!DOCTYPE html>
<html>
<body>
<?php
echo "It works";
?>
</body>
</html>
PHP文件在Server中执行,您需要本地主机服务器(如LAMP或Wamp)来执行PHP脚本
www
folder name as test.php
, and go to localhost/test.php
in your browser, you will see it works
file:///D:/web/hello.html
. But <?php ... ?>
is not valid html so you got a blank page. some links that might be useful to you
PHP is a server side language. If you want any php page to execute then definitely you need server whether it is virtually created or it is real. You are trying to run the php page directly which has no meaning to browser. You may use software like Wamp, Xamp that creates a virtual server on your PC. Try using this, then come back if you face any problem. For more info on how to use these, just GOOGLE them. You'll find millions of solutions there. Good Luck!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.