Drupal的 - hook_menu [英] drupal--hook_menu
本文介绍了Drupal的 - hook_menu的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<?php
function mymenu(){
$ item = array();
$ item ['mymenu'] = array(
'description'=>'test1',
'page callback'=>'mymenu_test',
' '=> array('access mymenu'),
'type'=> MENU_CALLBACK,
);
return $ item;
}
函数mymenu_perm(){
返回数组('access mymenu');
}
函数mymenu_test(){
$ output ='hello world';
return $ output;
}
我已经将匿名的访问mymenu权限给了。 >
解决方案
应该是
函数mymenu_menu(){
...
}
您不需要$ item = array();还有。
the info file is right,the following is my module file code. when i access the http://localhost/drupal/mymenu why it can't work.
<?php
function mymenu(){
$item = array();
$item['mymenu'] = array(
'description'=>'test1',
'page callback'=>'mymenu_test',
'access arguments' => array('access mymenu'),
'type'=>MENU_CALLBACK,
);
return $item;
}
function mymenu_perm(){
return array('access mymenu');
}
function mymenu_test() {
$output = 'hello world';
return $output;
}
i have gave the 'access mymenu' permission to the anonymous.
解决方案
It should be
function mymenu_menu() {
...
}
You don't need the $item = array(); there also.
这篇关于Drupal的 - hook_menu的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文