functionshowupversion () {#Get platform Type $type= ' Android '; #the path to the read file $url= "D:/www/gm_lequ/gm_lequ"; $file _name= "Update.ini"; $path=$url.‘ /‘.$type.‘ /‘.$file _name; #Determine if the path to the file exists to determine whether the directory exists we use Is_dir to OK. if(file_exists($path)){ #read php.ini JSON-formatted files $content=json_decode (file_get_contents($path),true); #get all the files $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 = "file does not exist!" "; } $this-display (); }
How PHP gets a JSON file