📅  最后修改于: 2023-12-03 15:03:44.442000             🧑  作者: Mango
phpinfo()
函数是在PHP中非常有用的函数之一。该函数将返回PHP环境的详细信息,包括PHP版本,已安装的扩展和配置设置等。
要使用phpinfo()
函数,您只需在PHP文件中调用它即可。以下是一个简单的示例:
<?php
phpinfo();
?>
当您运行此代码时,将在浏览器中显示一份非常详细的PHP环境信息报告。
以下是phpinfo()
函数输出的示例内容:
PHP Version 7.3.8
System Windows NT USER-PC 6.2 build 9200 (Windows 8 Home Premium Edition) i586
Build Date Aug 6 2019 12:32:48
Configure Command cscript /nologo configure.js "--enable-snapshot-build" "--enable-debug-pack" "--with-pdo-oci=c:\php-snap-build\deps_aux\oracle\x86\instantclient_12_1\sdk,shared" "--with-oci8-12c=c:\php-snap-build\deps_aux\oracle\x86\instantclient_12_1\sdk,shared" "--with-oci8=c:\php-snap-build\deps_aux\oracle\x86\instantclient_12_1\sdk,shared" "--with-libxml-dir=C:\php-sdk\deps\library_win32_libxml2\lib" "--with-openssl-dir=C:\php-sdk\deps\openssl\ssl" "--with-libsodium=shared" "--with-curl=shared" "--with-zlib=shared" "--with-gd=shared" "--with-jpeg-dir=shared" "--with-png-dir=shared" "--with-webp-dir=shared" "--with-xpm-dir=shared" "--with-freetype-dir=shared" "--with-gettext=shared" "--with-iconv-dir=shared" "--with-icu-dir=shared" "--with-pdo-odbc=shared,odbc_mdb" "--with-pdo-mysql=shared" "--with-pdo-pgsql=shared" "--with-pdo-dblib=shared" "--with-pgsql=shared" "--with-sqlite3=shared" "--with-sodium=shared" "--with-xmlrpc=shared" "--with-xsl=shared" "--with-pear" "--enable-fileinfo=shared" "--enable-mbstring=shared" "--enable-phar=shared" "--enable-phpdbg=shared" "--enable-shared=all" "--enable-debug" "--disable-cgi"
Server API Apache 2.0 Handler
Virtual Directory Support enabled
Configuration File (php.ini) Path C:\Windows
Loaded Configuration File C:\php\php.ini
Scan this dir for additional .ini files (none)
Additional .ini files parsed (none)
PHP API 20180731
PHP Extension 20180731
Zend Extension 320180731
Zend Extension Build API320180731,TS,VC15
PHP Extension Build API20180731,TS,VC15
Debug Build no
Thread Safety enabled
Thread API Windows Threads
.........
phpinfo()
函数可以向用户公开您的服务器详细信息。因此,应始终将其用于仅用于开发或测试目的的环境中。在生产环境中使用它是不安全的。
phpinfo()
函数是一个非常强大的函数,可用于检查PHP环境信息。但是,该函数应仅用于开发或测试环境,并且不应在生产环境中使用。