易截截图软件、单文件、免安装、纯绿色、仅160KB

php之XML转数组函数

<?
/**
* xml2array() will convert the given XML text to an array in the XML structure.
* Link: http://www.bin-co.com/php/scripts/xml2array/
* Arguments : $contents - The XML text
* $get_attributes - 1 or 0. If this is 1 the function will get the attributes as well as the tag values - this results in a different array structure in the return value.
* $priority - Can be 'tag' or 'attribute'. This will change the way the resulting array sturcture. For 'tag', the tags are given more importance.
* Return: The parsed XML in an array form. Use print_r() to see the resulting array structure.
* Examples: $array = xml2array(file_get_contents('feed.xml'));
* $array = xml2array(file_get_contents('feed.xml', 1, 'attribute'));
*/
function xml2array($contents, $get_attributes=1, $priority = 'tag') {
if(!$contents) return array();
if(!function_exists('xml_parser_create')) {
//print "'xml_parser_create()' function not found!";
return array();
}
//Get the XML parser of PHP - PHP must have this module for the parser to work
$parser = xml_parser_create('');
xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, "UTF-8"); # http://minutillo.com/steve/weblog/2004/6/17/php-xml-and-character-encodings-a-tale-of-sadness-rage-and-data-loss
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
xml_parse_into_struct($parser, trim($contents), $xml_values);
xml_parser_free($parser);
if(!$xml_values) return;//Hmm...
//Initializations
$xml_array = array();
$parents = array();
$opened_tags = array();
$arr = array();
$current = &$xml_array; //Refference
//Go through the tags.
$repeated_tag_index = array();//Multiple tags with same name will be turned into an array
foreach($xml_values as $data) {
unset(


相关文档:

浅谈用php对unicode转utf 8编码

(IT柏拉图 原创文章)如果只是unicode转utf-8编码的算法,网上到处都是了,不过很多人也是你抄我,我抄你,根本就不理解why和do,本文除了给出最简单的php对unicode转utf-8编码函数之外,也深入讨论了这两种编码的关系,理解好了会发现网上一些旧的东西,是严重多余兼过期的,因为从utf-8流行开始到现在,早已经由原来六字节 ......

php软件版 安装 问题

这两天一直在帮人做个软件可是俺只会用php,php程序的运行是基于Apache服务器的,没办法 要运行程序就必须运行服务器Apache服务器可以选用组装版的,下面分享下我的配置方法,用一个小的批处理程序就可以完成。
下面就是我的批处理程序:
@ ECHO OFF
copy d:\road\httpd-vhosts.conf c:\xampp\apache\conf\extra  / ......

php获取客户端操作系统信息(类文件)

<?php
class ClientGetObj{
function getOS(){
global $_SERVER;
$agent=$_SERVER["HTTP_USER_AGENT"];
$os=false;
if(eregi("win",$agent)&&strpos($agent,"95")){
$os="Windows 95";
}else if(eregi("win 9x",$agent)&&strpos($agent,"4.90")){
$os="Windows ME";
}else ......

PHP data函数的常用参数

a - 小写的am或pm
A - 大写的AM或PM
d - 日,两位数字,不足两位则前导自动补零
D - 表示星期的英文的前三个英文字母
F - 月份的英文全名
h - 12小时制,两位数字,不足两位则前导自动补零
H - 24小时制,两位数字,不足两位则前导自动补零
g - 12小时制,不足两位的小时不补零
G - 24小时制,不足两位的小时不补零 ......

——php图像处理类

<?
* +-------------------------------------------------------------+
* | Copyright (c) 2008-2009 Diqiye.Com All rights reserved.
* +-------------------------------------------------------------+
* | Info : 图像处理类
* +------------------------------------------------------------ ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号