放到sae中 ,请问这是怎么回事? 出错地方如下:
$foreach($arr_item as $item) {        $item_str .=sprintf($itemtpl,$item['title'],$item['description'],$item['picurl'],$item['url']);    }
代码贴到下面,望各位大神解决这个问题!
valid();//这里是测试网站配置信息和开发的是否一致。$wechatobj->responsemsg();//新增加这一项,目的是调用responsemsg()这个功能。class wechatcallbackapitest {//若确认此次get请求来自微信服务器,请原样返回echostr参数内容,则接入生效,否则接入失败。public function valid()     {         $echostr = $_get[echostr];         //alid signature , option         if($this->checksignature()){         echo $echostr;         exit;         }     } public function responsemsg()    {        $poststr = $globals[http_raw_post_data];        if (!empty($poststr)){            $postobj = simplexml_load_string($poststr, 'simplexmlelement', libxml_nocdata);            $rx_type = trim($postobj->msgtype);            switch ($rx_type)            {                case text:                    $resultstr = $this->receivetext($postobj);                    break;                case image:                    $resultstr = $this->receiveimage($postobj);                    break;                case location:                    $resultstr = $this->receivelocation($postobj);                    break;                case voice:                    $resultstr = $this->receivevoice($postobj);                    break;                case video:                    $resultstr = $this->receivevideo($postobj);                    break;                case link:                    $resultstr = $this->receivelink($postobj);                    break;                case event:                    $resultstr = $this->receiveevent($postobj);                    break;                default:                    $resultstr = unknow msg type: .$rx_type;                    break;            }            echo $resultstr;        }else {            echo ;            exit;        }    }    /*文本消息->1*/    private function receivetext($object){        $keyword = trim($object->content);        if(!empty($keyword)){         $url = http://www.tuling123.com/openapi/api?key=a2fcd4181d8aa942ca2e078b1c479684&info=.$keyword;         $data = file_get_contents($url);         $text =json_decode($data,ture);         $content = $text['text'];         $result =$this->transmittext($object,$content);        }        else if($keyword==图文||$keyword==单图文){            $content = array();            $content[]=array(title=>单图文标题,                             descrption=>单图文内容,                             picurl=>http://v1.qzone.cc/pic/201602/12/15/12/56bd85d5cb22d067.jpg%21600x600.jpg,                             url=>http://m.cnblogs.com/?u=txw1958);            $result = $this->transmitnews($object,$content);        }        else if($keyword==多图文){            $content = array();            $content[]=array(title=>多图文标题1,                             descrption=>图文内容,                             picurl=>http://v1.qzone.cc/pic/201602/12/15/12/56bd85d5cb22d067.jpg%21600x600.jpg,                             url=>http://m.cnblogs.com/?u=txw1958);            $content[]=array(title=>多图文标题2,                             descrption=>图文内容,                             picurl=>http://v1.qzone.cc/pic/201602/12/15/12/56bd85d5cb22d067.jpg%21600x600.jpg,                             url=>http://m.cnblogs.com/?u=txw1958);            $content[]=array(title=>多图文标题3,                             descrption=>图文内容,                             picurl=>http://v1.qzone.cc/pic/201602/12/15/12/56bd85d5cb22d067.jpg%21600x600.jpg,                             url=>http://m.cnblogs.com/?u=txw1958);            $result = $this->transmitnews($object,$content);        }else if($keyword==音乐){            $content = array(title=>七月上,                             descrption=>jam,                             musicurl=>http://sc1.111ttt.com/2015/5/12/28/105281351446.mp3,                             hqmusicurl=>http://sc1.111ttt.com/2015/5/12/28/105281351446.mp3);            $result = $this->transmitmusic($object,$content);        }        return $result;    }    /*图片消息->1*/    private function receiveimage($object){            $content=array(mediaid=>$object->mediaid);            $result = $this->transmitimage($object,$content);            return $result;    }    /*回复语音消息->1*/    private function receivevoice($object){            $content=array(mediaid=>$object->mediaid);            $result =$this->transmitvoice($object,$content);            return $result;    }    /*回复视频消息->*/    private function receivevideo($object){        $content=array(mediaid=>$object->mediaid,                        thumbmediaid=>$object->thumbmediaid,                        title=>,                        descrption=>);        $result=$this->transmitvideo($object,$content);        return $result;    }    /*回复文本消息->xml*/    private function transmittext($object,$content){        $texttpl = %s;        $result = sprintf($texttpl,$object->fromusername,$object->tousername,time(),$content);        return $result;    }    /*回复图片消息xml*/    private function transmitimage($object,$imagearray){        $itemtpl = ;        $item_str = sprintf($itemtpl,$imagearray['mediaid']);        $texttpl = %s                    $item_str                    ;        $result = sprintf($texttpl,$object->fromusername,$object->tousername,time());        return $result;    }    /*回复语音消息xml*/    private function transmitvoice($object,$voicearray){        $itemtpl = ;        $item_str = sprintf($itemtpl,$voicearray['mediaid']);        $texttpl = %s                    $item_str                    ;        $result = sprintf($texttpl,$object->fromusername,$object->tousername,time());        return $result;    }    /*回复视频消息xml*/    private function transmitvideo($object,$videoarray){        $itemtpl = ;        $item_str = sprintf($itemtpl,$videoarray['mediaid'],$videoarray['thumbmediaid'],$videoarray['title'],$videoarray['descrption']);        $texttpl = %s                    $item_str                    ;        $result = sprintf($texttpl,$object->fromusername,$object->tousername,time());        return $result;    }    /*回复图文消息xml*/    private function transmitnews($object,$arr_item){        if(!is_array($arr_item))            return;        $itemtpl = ;        $item_str = ;        $foreach($arr_item as $item) {            $item_str .=sprintf($itemtpl,$item['title'],$item['description'],$item['picurl'],$item['url']);        }        $newstpl = %s%s                    $item_str                    ;        $result = sprintf($newstpl,$object->fromusername,$object->tousername,time(),count($arr_item));        return $result;    }    /*回复音乐xml*/    private function transmitmusic($object,$musicarray){        $itemtpl = ;        $item_str = sprintf($itemtpl,$musicarray['title'],$musicarray['description'],$musicarray['musicurl'],$musicarray['hqmusicurl']);        $texttpl = %s                    $item_str                    ;        $result=sprintf($texttpl,$object->fromusername,$object->tousername,time());        return $result;    }// 开发者通过检验signature对请求进行校验 private function checksignature() {         $signature = $_get[signature];         $timestamp = $_get[timestamp];         $nonce = $_get[nonce];                 $token = token;         $tmparr = array($token, $timestamp, $nonce);         sort($tmparr);         $tmpstr = implode( $tmparr );         $tmpstr = sha1( $tmpstr );         if( $tmpstr == $signature ){             return true;             }else{                 return false;             }         } } ?> 
回复内容:                                                                                  放到sae中 ,请问这是怎么回事? 出错地方如下:
$foreach($arr_item as $item) {        $item_str .=sprintf($itemtpl,$item['title'],$item['description'],$item['picurl'],$item['url']);    }
代码贴到下面,望各位大神解决这个问题!
valid();//这里是测试网站配置信息和开发的是否一致。$wechatobj->responsemsg();//新增加这一项,目的是调用responsemsg()这个功能。class wechatcallbackapitest {//若确认此次get请求来自微信服务器,请原样返回echostr参数内容,则接入生效,否则接入失败。public function valid()     {         $echostr = $_get[echostr];         //alid signature , option         if($this->checksignature()){         echo $echostr;         exit;         }     } public function responsemsg()    {        $poststr = $globals[http_raw_post_data];        if (!empty($poststr)){            $postobj = simplexml_load_string($poststr, 'simplexmlelement', libxml_nocdata);            $rx_type = trim($postobj->msgtype);            switch ($rx_type)            {                case text:                    $resultstr = $this->receivetext($postobj);                    break;                case image:                    $resultstr = $this->receiveimage($postobj);                    break;                case location:                    $resultstr = $this->receivelocation($postobj);                    break;                case voice:                    $resultstr = $this->receivevoice($postobj);                    break;                case video:                    $resultstr = $this->receivevideo($postobj);                    break;                case link:                    $resultstr = $this->receivelink($postobj);                    break;                case event:                    $resultstr = $this->receiveevent($postobj);                    break;                default:                    $resultstr = unknow msg type: .$rx_type;                    break;            }            echo $resultstr;        }else {            echo ;            exit;        }    }    /*文本消息->1*/    private function receivetext($object){        $keyword = trim($object->content);        if(!empty($keyword)){         $url = http://www.tuling123.com/openapi/api?key=a2fcd4181d8aa942ca2e078b1c479684&info=.$keyword;         $data = file_get_contents($url);         $text =json_decode($data,ture);         $content = $text['text'];         $result =$this->transmittext($object,$content);        }        else if($keyword==图文||$keyword==单图文){            $content = array();            $content[]=array(title=>单图文标题,                             descrption=>单图文内容,                             picurl=>http://v1.qzone.cc/pic/201602/12/15/12/56bd85d5cb22d067.jpg%21600x600.jpg,                             url=>http://m.cnblogs.com/?u=txw1958);            $result = $this->transmitnews($object,$content);        }        else if($keyword==多图文){            $content = array();            $content[]=array(title=>多图文标题1,                             descrption=>图文内容,                             picurl=>http://v1.qzone.cc/pic/201602/12/15/12/56bd85d5cb22d067.jpg%21600x600.jpg,                             url=>http://m.cnblogs.com/?u=txw1958);            $content[]=array(title=>多图文标题2,                             descrption=>图文内容,                             picurl=>http://v1.qzone.cc/pic/201602/12/15/12/56bd85d5cb22d067.jpg%21600x600.jpg,                             url=>http://m.cnblogs.com/?u=txw1958);            $content[]=array(title=>多图文标题3,                             descrption=>图文内容,                             picurl=>http://v1.qzone.cc/pic/201602/12/15/12/56bd85d5cb22d067.jpg%21600x600.jpg,                             url=>http://m.cnblogs.com/?u=txw1958);            $result = $this->transmitnews($object,$content);        }else if($keyword==音乐){            $content = array(title=>七月上,                             descrption=>jam,                             musicurl=>http://sc1.111ttt.com/2015/5/12/28/105281351446.mp3,                             hqmusicurl=>http://sc1.111ttt.com/2015/5/12/28/105281351446.mp3);            $result = $this->transmitmusic($object,$content);        }        return $result;    }    /*图片消息->1*/    private function receiveimage($object){            $content=array(mediaid=>$object->mediaid);            $result = $this->transmitimage($object,$content);            return $result;    }    /*回复语音消息->1*/    private function receivevoice($object){            $content=array(mediaid=>$object->mediaid);            $result =$this->transmitvoice($object,$content);            return $result;    }    /*回复视频消息->*/    private function receivevideo($object){        $content=array(mediaid=>$object->mediaid,                        thumbmediaid=>$object->thumbmediaid,                        title=>,                        descrption=>);        $result=$this->transmitvideo($object,$content);        return $result;    }    /*回复文本消息->xml*/    private function transmittext($object,$content){        $texttpl = %s;        $result = sprintf($texttpl,$object->fromusername,$object->tousername,time(),$content);        return $result;    }    /*回复图片消息xml*/    private function transmitimage($object,$imagearray){        $itemtpl = ;        $item_str = sprintf($itemtpl,$imagearray['mediaid']);        $texttpl = %s                    $item_str                    ;        $result = sprintf($texttpl,$object->fromusername,$object->tousername,time());        return $result;    }    /*回复语音消息xml*/    private function transmitvoice($object,$voicearray){        $itemtpl = ;        $item_str = sprintf($itemtpl,$voicearray['mediaid']);        $texttpl = %s                    $item_str                    ;        $result = sprintf($texttpl,$object->fromusername,$object->tousername,time());        return $result;    }    /*回复视频消息xml*/    private function transmitvideo($object,$videoarray){        $itemtpl = ;        $item_str = sprintf($itemtpl,$videoarray['mediaid'],$videoarray['thumbmediaid'],$videoarray['title'],$videoarray['descrption']);        $texttpl = %s                    $item_str                    ;        $result = sprintf($texttpl,$object->fromusername,$object->tousername,time());        return $result;    }    /*回复图文消息xml*/    private function transmitnews($object,$arr_item){        if(!is_array($arr_item))            return;        $itemtpl = ;        $item_str = ;        $foreach($arr_item as $item) {            $item_str .=sprintf($itemtpl,$item['title'],$item['description'],$item['picurl'],$item['url']);        }        $newstpl = %s%s                    $item_str                    ;        $result = sprintf($newstpl,$object->fromusername,$object->tousername,time(),count($arr_item));        return $result;    }    /*回复音乐xml*/    private function transmitmusic($object,$musicarray){        $itemtpl = ;        $item_str = sprintf($itemtpl,$musicarray['title'],$musicarray['description'],$musicarray['musicurl'],$musicarray['hqmusicurl']);        $texttpl = %s                    $item_str                    ;        $result=sprintf($texttpl,$object->fromusername,$object->tousername,time());        return $result;    }// 开发者通过检验signature对请求进行校验 private function checksignature() {         $signature = $_get[signature];         $timestamp = $_get[timestamp];         $nonce = $_get[nonce];                 $token = token;         $tmparr = array($token, $timestamp, $nonce);         sort($tmparr);         $tmpstr = implode( $tmparr );         $tmpstr = sha1( $tmpstr );         if( $tmpstr == $signature ){             return true;             }else{                 return false;             }         } } ?> 
foreach不是变量,为什么前面有个$?
   
 
   