test.php创建一个新页面,该页面完全不包含任何类型的代码(文件的实际名称无关紧要,只要它遵循标准的Web命名约定并带有.php后缀即可)。 在此页面上,编写一行PHP代码:
<?php phpInfo(); ?>
Then upload or place the page in the appropriate directory on your server and use your web browser to navigate to the page.
然后将页面上载或放置在服务器上的适当目录中,并使用Web浏览器导航到该页面。
If the server is running PHP, what you will see may surprise you: a huge presentation of data pulled live from the server regarding PHP, Apache, and associated modules. While very simple, this also demonstrates how powerful server-side languages can be: a single function can generate an incredible amount of content.
如果服务器运行的是PHP,您将看到的结果可能会让您感到惊讶:从服务器实时获取的有关PHP,Apache和关联模块的大量数据展示。 尽管非常简单,但这也说明了服务器端语言的强大功能:单个功能可以生成大量内容。
To extend this lesson, take a look at the source code of the generated page (CTRL-U/CMD-U in most browsers). Note that you do not see any trace of PHP code; you only see the HTML and CSS generated by PHP. The browser never directly interacts with PHP; it only receives its output, expressed as HTML, CSS, JavaScript or images.
要扩展本课程,请查看生成的页面的源代码(在大多数浏览器中为CTRL-U / CMD-U )。 注意,您看不到任何PHP代码痕迹。 你只看到 PHP生成HTML和CSS。 浏览器从不直接与PHP交互; 它仅接收其输出,表示为HTML , CSS , JavaScript或图像 。
翻译自: https://thenewcode.com/175/How-Do-I-Know-If-My-Web-Server-Supports-PHP