微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

php-如何在drupal 7中定义模块级别的变量

如何在drupal模块中定义变量,以便我可以从任何函数访问该模块中的那些变量

解决方法:

尝试variable_set()和variable_get()

像这样设置变量:

// I have assumed the variable name to be "the_name_of_the_variable"
variable_set("the_name_of_the_variable", "the value of the variable");

然后像这样检索值:

$my_variable = variable_get("the_name_of_the_variable", "a default value in case the variable has never been set before");

希望这可以帮助…穆罕德.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐