【问题标题】:how do I write this php code [closed]我该如何编写这个 php 代码 [关闭]
【发布时间】:2023-04-03 11:45:02
【问题描述】:

您能否告诉我如何正确编写此 php 代码:

if (function_exists('apache_get_modules')) {
apache_get_modules()
and other related code
}
else {
no support for apache modules, maybe phpinfo show some related info
}

谢谢

【问题讨论】:

  • 代码的作用是什么?
  • 查看apache_get_modules()函数是否存在,如果不存在则写“不支持apache模块”
  • function_exists('apache_get_modules') ? apache_get_modules() : print('no support for apache modules');:P

标签: php apache


【解决方案1】:

你可以试试这个

<?php
if (function_exists('apache_get_modules')) {
    // call the function
    apache_get_modules();
    // write your other related code
}
else{
    // show message 
    echo "no support for apache modules";
    // get php info
    phpinfo();
}
?>

【讨论】:

  • 解析错误:语法错误,第 2 行 /home/u170201516/public_html/test.php 中出现意外的 'if' (T_IF)
  • 那么...第一行是什么?如果不是&lt;?php,那是你的问题。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-02-05
  • 2013-06-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多