第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

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

為啥老是抱這個錯誤

為啥老是抱這個錯誤

PHP
Alpaca楓 2015-11-19 19:38:37
class Response{ /** * @param integer $code 狀態(tài)碼 * @param string $message 提示信息 * @param array $data 數(shù)據(jù) ? * 返回 string(json) */ public static function jsonData($code,$message,$data = array()){ //如果狀態(tài)碼不是數(shù)字直接返回null if(!is_numeric($code)){ return 'not a num'; } //封裝數(shù)據(jù) $result = array( 'code' => $code, 'message' => $message, 'data' => $data ); echo json_encode($result); } /** * @param integer $code 狀態(tài)碼 * @param string $message 提示信息 * @param array $data 數(shù)據(jù) * 返回 string(xml) */ public static function ?xmlData($code, $message,$data = array()){ if(!is_numeric($code)){ return ''; } //封裝array數(shù)據(jù) $result = array( 'code'=>$code, 'message'=>$message, 'data'=>$data, ); //封裝xml數(shù)據(jù) 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 回答

  • 1 回答
  • 0 關(guān)注
  • 1247 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號