php 如何获取一个json文件
function showupversion(){ #获取平台类型 $type='android'; #读取文件的路径 $url="D:/WWW/gm_lequ/gm_lequ"; $file_name="update.ini"; $path=$url.'/'.$type.'/'.$file_name; #判断文件的路径是否存在 判断目录是否存在我们用is_dir就OK了。 if(file_exists($path)){ #读取php.ini json格式的文件 $content=json_decode(file_get_contents($path),true); #获取所有的文件 $file_name_array=$this->showGetFileName($type,$url); $this->Tmpl['option']=""; foreach ($file_name_array as $v){ if($content['upVer']==$v){ $this->Tmpl['option'].="<option selected='selected'>{$v}</option>"; }else{ $this->Tmpl['option'].="<option >{$v}</option>"; } } $this->Tmpl['mainVer']=$content['mainVer']; $this->Tmpl['upVer']=$content['upVer']; $this->Tmpl['upTips']=$content['upTips']; $this->Tmpl['assetPath']=$content['assetPath']; $this->Tmpl['newUpiniPath']=$content['newUpiniPath']; $this->Tmpl['appStore']=$content['appStore']; $this->Tmpl['forceUpdateVersion']=$content['forceUpdateVersion']; }else{ $this->PromptMsg = "文件不存在!"; } $this->display(); }