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");

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

相关文章

统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
前言 之前做了微信登录,所以总结一下微信授权登录并获取用户...
FastAdmin是我第一个接触的后台管理系统框架。FastAdmin是一...
之前公司需要一个内部的通讯软件,就叫我做一个。通讯软件嘛...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...