gpt4 book ai didi

php - 在wordpress中查找并打印mysql的主机名

转载 作者:行者123 更新时间:2023-11-29 12:09:40 25 4
gpt4 key购买 nike

我正在尝试使用 wordpress 查找 sql 的主机名。即我想从 'http://**localhost**/velocity/wordpress/?page_id=4'

打印 ' localhost'

我尝试了函数home_get_url()但我得到了如上所示的完整路径。当我尝试使用 gethostname() 时,我得到了我的PC 名称。 '

请帮忙。我刚刚接触 WordPress

最佳答案

希望对您有帮助。

printf("MySQL host info: %s\n", mysql_get_host_info());

你也可以尝试一下。

<?php
echo gethostname(); // may output e.g,: sandie

// Or, an option that also works before PHP 5.3
echo php_uname('n'); // may output e.g,: sandie
?>

了解更多信息。 http://www.php.net/manual/en/function.gethostname.php

关于php - 在wordpress中查找并打印mysql的主机名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30906875/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com