开发者

Drupal 6 knowing it's current environment

开发者 https://www.devze.com 2023-01-07 08:29 出处:网络
I want to write a utility function so my Drupal project knows if it\'s run开发者_运维知识库ning on the development, staging or live server.

I want to write a utility function so my Drupal project knows if it's run开发者_运维知识库ning on the development, staging or live server.

Something like:

function mymodule_is_development() {  
    return (//some condition) ? TRUE : FALSE;  
}

Does anyone know how to do this the Drupal way? Drupal's multisite functionality should be leveraged I think...


Take a look at Environment Indicator and how it works. You can use the settings.php to set a variable, or store one in the database with variable_set.


You can also try:

global $base_url;
0

精彩评论

暂无评论...
验证码 换一张
取 消