标签:
01
<?php function mytracer_menu() { $items = array(); $items[‘admin/config/mytracer‘] = array( ‘title‘ => ‘My Tracer‘, ‘description‘ => ‘MY tracer des‘, ‘access callback‘ => true, ‘page callback‘ => ‘mytracer_admin‘, ); return $items; } //全局变量的使用 function mytracer_admin() { global $base_path; global $base_url; global $user; $output = ‘‘; $output .=‘<p>‘. $base_path . ‘</p>‘; $output .=‘<p>‘. $base_url . ‘</p>‘; dpm($user); return $output; }
02 ,永久变量的使用
function mytracer_admin() { //定义一个mytracer_setting1 为10 $var1 = variable_get(‘mytracer_setting1‘, 10); $output = ‘‘; $output .= ‘变量‘. $var1; //把mytracer_setting1值加1 variable_set(‘mytracer_setting1‘, $var1+1); //删除mytracer_setting1变量 //variable_del(‘mytracer_setting1‘); return $mytracer_setting1; }
标签:
原文地址:http://www.cnblogs.com/suihui/p/4568960.html