我创建了一个带有hook_menu函数的路径,该函数用于访问匿名用户。定义是:
##generic access point for API calls # items['api'] = array( 'title' => 'api access point', 'description' => 'Pass all api calls thru single access point to simplify code', 'page callback' => 'xxxxxxx_utility_api', 'access arguments' => array('access content'), 'access callback' => TRUE, 'type' => MENU_CALLBACK, );
路径www.mysite.com/api/aaa/bbb / ...
返回JSON
并且只要我登录就可以运行,但我需要允许匿名访问路径
如何配置drupal以允许匿名访问返回JSON的路径
答案 0 :(得分:0)
您需要有2个级别并删除访问参数和下一个清除缓存菜单(drush cc菜单)
items['api/custom'] = array(
'title' => 'api access point',
'description' => 'Pass all api calls thru single access point to simplify code',
'page callback' => 'xxxxxxx_utility_api',
// 'access arguments' => array('access content'),
'access callback' => TRUE,
'type' => MENU_CALLBACK, );