PHPCMS通過getJSON調用的地址方法必須加public_PHP教程

來源:互聯網
上載者:User
今天遇到一個getJSON的問題,回呼函數一直無法執行,檢查了產生的json資料的格式絕對沒問題,getJSON的js文法也沒問題,但就是alert不出來傳回的資料。原來是phpcms的check_hash()函數對遠程調用的方法進行了安全驗證, 方法名前沒public_的都不能通過

  (('/^public_/', ROUTE_A) || ROUTE_M =='admin' && ROUTE_C =='index' || (ROUTE_A, ('login' ((['pc_hash']) && ['pc_hash'] != '' && (['pc_hash'] == ['pc_hash' ((['pc_hash']) && ['pc_hash'] != '' && (['pc_hash'] == ['pc_hash' 'hash_check_false'),

phpcms給函數進行了hash驗證,因此,現在方法是這樣寫的:

  public_mobile_getjson_ids() {     = (['modelid' = (['id'->db->set_model( = ->db->->db->table_name = .'_data' = ->db->get_one(('id'=>),'mobile_type'(['mobile_type' = ('|', ',', ['mobile_type' = (,',' = "id IN()" = ->mobile_db = pc_base::load_model ( 'mobile_type_model' = ->mobile_db->select(,'id,type_name'db->table_name = $tablename;        //$datas = $this->db->select($where,'id,title');        (  ['sid'] = 'v'.['id'((CHARSET)=='gbk') ['type_name'] = ('gbk', 'utf-8', ['type_name'[] =  json_encode(

js部分的getJSON是這樣寫的:

"?m=content&c=content&a=public_mobile_getjson_ids&modelid="+modelid+"&id="+id,  newrelation_ids = ''(json=='沒有添加相關文章' += "
  • ·"+n.type_name+"
  • "'#mobile_type_text'

    就好了。要注意phpcms裡面調用遠程地址,方法前加上public啊!!

    http://www.bkjia.com/PHPjc/740287.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/740287.htmlTechArticle今天遇到一個getJSON的問題,回呼函數一直無法執行,檢查了產生的json資料的格式絕對沒問題,getJSON的js文法也沒問題,但就是alert不出來傳...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.