亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

This page contains the following errors: error on line 2 at column 1: Extra content at the end of the document Below is a rendering of the page up to the first error.

This page contains the following errors: error on line 2 at column 1: Extra content at the end of the document Below is a rendering of the page up to the first error.

PHP
Alpaca楓 2015-11-19 19:43:06
class?Response{ /** ?*?@param?integer?$code?狀態碼 ?*?@param?string?$message?提示信息 ?*?@param?array?$data?數據?? ?*?返回?string(json) ?*/ public?static?function?jsonData($code,$message,$data?=?array()){ //如果狀態碼不是數字直接返回null if(!is_numeric($code)){ return?'not?a?num'; } //封裝數據 $result?=?array( 'code'?=>?$code, 'message'?=>?$message, 'data'?=>?$data ); echo?json_encode($result); } /** ?*?@param?integer?$code?狀態碼 ?*?@param?string?$message?提示信息 ?*?@param?array?$data?數據 ?*?返回?string(xml) ?*/ public?static?function??xmlData($code,?$message,$data?=?array()){ if(!is_numeric($code)){ return?''; } //封裝array數據 $result?=?array( 'code'=>$code, 'message'=>$message, 'data'=>$data, ); //封裝xml數據 header("Content-Type:text/xml"); $xml="<?xml?version='1.0'?encoding='UTF-8'?>\n"; $xml.="<root>\n"; $xml.=?self::xmlToEncode($result); $xml.="</root>"; echo?$xml; } public?static?function?xmlToEncode($data){ $xml=""; foreach($data?as?$key=>$value){ $xml.="<{$key}>"; $xml.="$value"; $xml.="</{$key}>\n"; } return?$xml; } } $data?=?array( 'id'=>1, 'name'=>'mike', 'num'=>123, ); Response::xmlData(200,?"ggood",$data); ?>
查看完整描述

1 回答

?
韌還

TA貢獻17條經驗 獲得超9個贊

額,第二行應該是/*

/**就可能報錯

查看完整回答
反對 回復 2015-11-19
  • 1 回答
  • 0 關注
  • 5085 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號