600字范文,内容丰富有趣,生活中的好帮手!
600字范文 > PHP object(SimpleXMLElement) 对象转换为数组

PHP object(SimpleXMLElement) 对象转换为数组

时间:2022-06-28 09:34:27

相关推荐

PHP object(SimpleXMLElement) 对象转换为数组

php教程|PHP源码

PHP object(SimpleXMLElement) 对象转换为数组

php教程-PHP源码

跳至

[1]

[2]

新片电影网站源码,pe怎么引导ubuntu,修改tomcat8端口号,审计爬虫怎么防,php在数据库插入数据,店铺seo权重lzw

[全屏预览]

object(SimpleXMLElement)[9] public esult =>object(SimpleXMLElement)[8] public err_code => string (length=1)public model => string 00000000000^000000000000 (length=26)public success => string rue (length=4) public equest_id => string 00000000000 (length=13)

php 文章发布系统源码,vscode script,ubuntu nohup,tomcat清除,sqlite设置密码,阿里云服务器选什么地区好,浏览器h5插件,前端框架与seo,java 网络爬虫 框架,西安php建站,菲律seo,网站首页源码,卡通风网页题材,cctv新闻模板,微信 页面模板 源代码,php学籍管理系统源码,线性插值法matlab程序lzw

示例:PHP object(SimpleXMLElement) 对象转换为数组的方式

[全屏预览]

class xml{ /** * object(SimpleXMLElement) 对象转换为数组 * convert simplexml object to array sets * $array_tags 表示需要转为数组的 xml 标签。例:array(item, \) * 出错返回False * * @param object $simplexml_obj * @param array $array_tags * @param int $strip_white 是否清除左右空格 * @return mixed */ public static function toArray($simplexml_obj, $array_tags=array(), $strip_white=1) { if( $simplexml_obj ) { if( count($simplexml_obj)==0 )return $strip_white?trim((string)$simplexml_obj):(string)$simplexml_obj; $attr = array(); foreach ($simplexml_obj as $k=>$val) {if( !empty($array_tags) && in_array($k, $array_tags) ) { $attr[] = self::toArray($val, $array_tags, $strip_white);}else{ $attr[$k] = self::toArray($val, $array_tags, $strip_white);} } return $attr; } return false; }}

.code_report{float:right}.code_report div{ float: left; margin-left: 5px; background: url(“/img/ask-icon.jpg”) no-repeat; padding: 6px 0 6px 15px; padding-left: 15px; height: 16px;}.code_report a{ background: url(“/img/ask-icon.jpg”) 0 -160px no-repeat;padding-left: 20px; line-height: 15px;height: 16px; color: #333; text-decoration: none; display:inline-block; zoom:1; vertical-align: middle;}.code_report em{ height: 28px; line-height:28px; width: 14px; display: inline-block; float: left; background: url(“/img/ask-icon.jpg”) top right;}

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。