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");
希望这可以帮助…穆罕默德.
标签:variables,drupal,drupal-7,php 来源: https://codeday.me/bug/20191031/1977009.html