当前位置: 首页>>代码示例>>PHP>>正文


PHP xml_serialize函数代码示例

本文整理汇总了PHP中xml_serialize函数的典型用法代码示例。如果您正苦于以下问题:PHP xml_serialize函数的具体用法?PHP xml_serialize怎么用?PHP xml_serialize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了xml_serialize函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _serialize

 function _serialize($arr, $htmlon = 0)
 {
     if (!function_exists('xml_serialize')) {
         include_once DISCUZ_ROOT . './uc_client/lib/xml.class.php';
     }
     return xml_serialize($arr, $htmlon);
 }
开发者ID:BGCX067,项目名称:f2cont-svn-to-git,代码行数:7,代码来源:uc.php

示例2: _serialize

 function _serialize($arr, $htmlon = 0)
 {
     if (!function_exists('xml_serialize')) {
         include_once UC_CLIENT_PATH . 'uc_client/lib/xml.class.php';
     }
     return xml_serialize($arr, $htmlon);
 }
开发者ID:h3len,项目名称:Project,代码行数:7,代码来源:uc.php

示例3: serialize

 public static function serialize($arr, $htmlon = 0)
 {
     if (!function_exists('xml_serialize')) {
         include API_ROOT . 'uc_client/lib/xml.class.php';
     }
     return xml_serialize($arr, $htmlon);
 }
开发者ID:mvpydq,项目名称:ucenter,代码行数:7,代码来源:Help.php

示例4: _serialize

 function _serialize($arr, $htmlon = 0)
 {
     if (!function_exists('xml_serialize')) {
         include $this->appdir . 'uc_client/lib/xml.class.php';
     }
     return xml_serialize($arr, $htmlon);
 }
开发者ID:dalinhuang,项目名称:concourse,代码行数:7,代码来源:uc.php

示例5: xml_serialize

function xml_serialize(&$data, $htmlon = 0, $level = 1)
{
    $space = str_repeat("\t", $level);
    $cdatahead = $htmlon ? '<![CDATA[' : '';
    $cdatafoot = $htmlon ? ']]>' : '';
    $s = '';
    if (!empty($data)) {
        foreach ($data as $key => $val) {
            if (!is_array($val)) {
                $val = "{$cdatahead}{$val}{$cdatafoot}";
                if (is_numeric($key)) {
                    $s .= "{$space}<item_{$key}>{$val}</item_{$key}>";
                } elseif ($key === '') {
                    $s .= '';
                } else {
                    $s .= "{$space}<{$key}>{$val}</{$key}>";
                }
            } else {
                if (is_numeric($key)) {
                    $s .= "{$space}<item_{$key}>" . xml_serialize($val, $htmlon, $level + 1) . "{$space}</item_{$key}>";
                } elseif ($key === '') {
                    $s .= '';
                } else {
                    $s .= "{$space}<{$key}>" . xml_serialize($val, $htmlon, $level + 1) . "{$space}</{$key}>";
                }
            }
        }
    }
    $s = preg_replace("/([-\t\v-\f-])+/", ' ', $s);
    return ($level == 1 ? "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><root>" : '') . $s . ($level == 1 ? '</root>' : '');
}
开发者ID:dalinhuang,项目名称:shopexts,代码行数:31,代码来源:xml.class.php

示例6: xml_serialize

function xml_serialize($arr, $htmlon = FALSE, $isnormal = FALSE, $level = 1) {
	$s = $level == 1 ? "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\r\n<root>\r\n" : '';
	$space = str_repeat("\t", $level);
	foreach($arr as $k => $v) {
		if(!is_array($v)) {
			$s .= $space."<item id=\"$k\">".($htmlon ? '<![CDATA[' : '').$v.($htmlon ? ']]>' : '')."</item>\r\n";
		} else {
			$s .= $space."<item id=\"$k\">\r\n".xml_serialize($v, $htmlon, $isnormal, $level + 1).$space."</item>\r\n";
		}
	}
	$s = preg_replace("/([\x01-\x09\x0b-\x0c\x0e-\x1f])+/", ' ', $s);
	return $level == 1 ? $s."</root>" : $s;
}
开发者ID:noikiy,项目名称:mdwp,代码行数:13,代码来源:xml.class.php

示例7: serialize

 public static function serialize($arr, $htmlon = false, $isnormal = false, $level = 1)
 {
     $s = $level == 1 ? "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\r\n<root>\r\n" : '';
     $space = str_repeat("\t", $level);
     foreach ($arr as $k => $v) {
         if (!is_array($v)) {
             $s .= $space . "<item id=\"{$k}\">" . ($htmlon ? '<![CDATA[' : '') . $v . ($htmlon ? ']]>' : '') . "</item>\r\n";
         } else {
             $s .= $space . "<item id=\"{$k}\">\r\n" . xml_serialize($v, $htmlon, $isnormal, $level + 1) . $space . "</item>\r\n";
         }
     }
     $s = preg_replace("/([-\v-\f-])+/", ' ', $s);
     return $level == 1 ? $s . "</root>" : $s;
 }
开发者ID:tenstone,项目名称:ucenter-client,代码行数:14,代码来源:SerializerXml.php

示例8: serialize

 public static function serialize($arr, $htmlOn = 0)
 {
     if (!function_exists('xml_serialize')) {
         require APPPATH . '../uc_client/lib/xml.class.php';
     }
     return xml_serialize($arr, $htmlOn);
 }
开发者ID:chentaoz,项目名称:TourismWeb,代码行数:7,代码来源:uc.php

示例9: uc_serialize

function uc_serialize($arr, $htmlon = 0)
{
    include_once '../uc_client/lib/xml.class.php';
    return xml_serialize($arr, $htmlon);
}
开发者ID:shenhua4286,项目名称:gxw,代码行数:5,代码来源:uc.php

示例10: header

    case 'POST':
        $row = $model->fetchByPK(@$_GET[$model->pkey]);
        if (is_null($row)) {
            header("HTTP/1.0 404 Not Found");
            exit;
        }
        $pkey = $model->update($PAYLOAD, $_GET);
        if (!$pkey) {
            trigger_error("Failed to update");
            exit;
        }
        header("HTTP/1.0 200 OK");
        exit;
    case 'DELETE':
        $row = $model->fetchByPK(@$_GET[$model->pkey]);
        if (is_null($row)) {
            header("HTTP/1.0 404 Not Found");
            exit;
        }
        if (!$model->deleteByPK(@$_GET[$model->pkey])) {
            trigger_error("Failed to delete");
            exit;
        }
        header("Content-Type:text/xml");
        echo "<?xml version='1.0' ?" . ">";
        echo xml_serialize('result', array('status' => "ok"));
        exit;
    default:
        trigger_error("Unrecognized request-method: " . $REQUEST_METHOD);
        exit;
}
开发者ID:BackupTheBerlios,项目名称:freja-svn,代码行数:31,代码来源:inc.resource.php

示例11: Export

 function Export()
 {
     $id = jget('id', 'int');
     $plugin_info = jlogic('plugin')->getpluginbyid($id);
     if ($plugin_info) {
         $export_ary = array();
         $export_ary['Title'] = 'JishiGou! Plugin';
         $export_ary['Version'] = SYS_VERSION;
         $export_ary['Time'] = my_date_format(time());
         $export_ary['Data']['plugin']['available'] = 0;
         $export_ary['Data']['plugin']['name'] = $plugin_info['name'];
         $export_ary['Data']['plugin']['identifier'] = $plugin_info['identifier'];
         $export_ary['Data']['plugin']['description'] = $plugin_info['description'];
         $export_ary['Data']['plugin']['directory'] = $plugin_info['directory'];
         $export_ary['Data']['plugin']['copyright'] = $plugin_info['copyright'];
         $export_ary['Data']['plugin']['version'] = $plugin_info['version'];
         $export_ary['Data']['plugin']['__modules'] = unserialize($plugin_info['modules']);
         $plugin_var = jlogic('plugin')->getpluginvarbyid($id);
         foreach ($plugin_var as $temp => $val) {
             $export_ary['Data']['var'][$temp]['displayorder'] = $val['displayorder'];
             $export_ary['Data']['var'][$temp]['title'] = $val['title'];
             $export_ary['Data']['var'][$temp]['description'] = $val['description'];
             $export_ary['Data']['var'][$temp]['variable'] = $val['variable'];
             $export_ary['Data']['var'][$temp]['type'] = $val['type'];
             $export_ary['Data']['var'][$temp]['value'] = $val['value'];
             $export_ary['Data']['var'][$temp]['extra'] = $val['extra'];
         }
         $plugindir = PLUGIN_DIR . '/' . $plugin_info['directory'];
         if (file_exists($plugindir . '/install.php')) {
             $export_ary['installfile'] = 'install.php';
         }
         if (file_exists($plugindir . '/upgrade.php')) {
             $export_ary['upgradefile'] = 'upgrade.php';
         }
         if (file_exists($plugindir . '/uninstall.php')) {
             $export_ary['uninstallfile'] = 'uninstall.php';
         }
         $xml = xml_serialize($export_ary, true);
         $filename = strtolower(str_replace(array('!', ' '), array('', '_'), 'JishiGou! Plugin')) . '_' . $plugin_info['identifier'] . '.xml';
         ob_end_clean();
         header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
         header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
         header('Cache-Control: no-cache, must-revalidate');
         header('Pragma: no-cache');
         header('Content-Encoding: none');
         header('Content-Length: ' . strlen($xml));
         header('Content-Disposition: attachment; filename=' . $filename);
         header('Content-Type: text/xml');
         echo $xml;
         exit;
     } else {
         $this->Messager("未找到该插件", 'admin.php?mod=plugin');
     }
 }
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:54,代码来源:plugindesign.mod.php

示例12: ob_start

function &xml_serialize(&$data, $level = 0, $prior_key = NULL)
{
    if ($level == 0) {
        ob_start();
        echo '<?xml version="1.0" ?>', "\n";
    }
    while (list($key, $value) = each($data)) {
        if (!strpos($key, ' attr')) {
            #if it's not an attribute
            #we don't treat attributes by themselves, so for an empty element
            # that has attributes you still need to set the element to NULL
            if (is_array($value) and array_key_exists(0, $value)) {
                xml_serialize($value, $level, $key);
            } else {
                $tag = $prior_key ? $prior_key : $key;
                echo str_repeat("\t", $level), '<', $tag;
                if (array_key_exists("{$key} attr", $data)) {
                    #if there's an attribute for this element
                    while (list($attr_name, $attr_value) = each($data["{$key} attr"])) {
                        echo ' ', $attr_name, '="', htmlspecialchars($attr_value), '"';
                    }
                    reset($data["{$key} attr"]);
                }
                if (is_null($value)) {
                    echo " />\n";
                } elseif (!is_array($value)) {
                    echo '>', htmlspecialchars($value), "</{$tag}>\n";
                } else {
                    echo ">\n", xml_serialize($value, $level + 1), str_repeat("\t", $level), "</{$tag}>\n";
                }
            }
        }
    }
    reset($data);
    if ($level == 0) {
        $str =& ob_get_contents();
        ob_end_clean();
        return $str;
    }
}
开发者ID:platform-project,项目名称:platform-project,代码行数:40,代码来源:global.php

示例13: Publish

 function Publish()
 {
     $id = jget('id', 'int');
     $plugin_info = jlogic('plugin')->getpluginbyid($id);
     if (!$plugin_info) {
         $this->Messager("操作失败!");
     }
     $plugindir = PLUGIN_DIR . '/' . $plugin_info['directory'];
     $tempdir = PLUGIN_DIR . '/' . $plugin_info['directory'] . 'template/';
     if (!is_dir($plugindir)) {
         jio()->MakeDir($plugindir);
     }
     if (!is_dir($tempdir)) {
         jio()->MakeDir($tempdir);
     }
     $export_ary = array();
     $export_ary['Title'] = 'JishiGou! Plugin';
     $export_ary['Version'] = SYS_VERSION;
     $export_ary['Time'] = my_date_format(time());
     $export_ary['Data']['plugin']['available'] = 0;
     $export_ary['Data']['plugin']['name'] = $plugin_info['name'];
     $export_ary['Data']['plugin']['identifier'] = $plugin_info['identifier'];
     $export_ary['Data']['plugin']['description'] = $plugin_info['description'];
     $export_ary['Data']['plugin']['directory'] = $plugin_info['directory'];
     $export_ary['Data']['plugin']['copyright'] = $plugin_info['copyright'];
     $export_ary['Data']['plugin']['version'] = $plugin_info['version'];
     $export_ary['Data']['plugin']['__modules'] = unserialize($plugin_info['modules']);
     $plugin_var = jlogic('plugin')->getpluginvarbyid($id);
     if (is_array($plugin_var)) {
         foreach ($plugin_var as $temp => $val) {
             $export_ary['Data']['var'][$temp]['displayorder'] = $val['displayorder'];
             $export_ary['Data']['var'][$temp]['title'] = $val['title'];
             $export_ary['Data']['var'][$temp]['description'] = $val['description'];
             $export_ary['Data']['var'][$temp]['variable'] = $val['variable'];
             $export_ary['Data']['var'][$temp]['type'] = $val['type'];
             $export_ary['Data']['var'][$temp]['value'] = $val['value'];
             $export_ary['Data']['var'][$temp]['extra'] = $val['extra'];
         }
     }
     $export_ary['installfile'] = 'install.php';
     $export_ary['upgradefile'] = 'upgrade.php';
     $export_ary['uninstallfile'] = 'uninstall.php';
     $xmldata = xml_serialize($export_ary, true);
     $filename = $plugindir . 'jishigou_plugin_' . $plugin_info['identifier'] . '.xml';
     $len = jio()->WriteFile($filename, $xmldata);
     if (false === $len) {
         $this->Messager("文件无法写入,请检查是否有可写权限。");
     }
     $data = "<?php\r\nif(!defined('IN_JISHIGOU')) {\r\n    exit('invalid request');\r\n}\r\n?>";
     jio()->WriteFile($plugindir . $export_ary['installfile'], $data);
     jio()->WriteFile($plugindir . $export_ary['upgradefile'], $data);
     jio()->WriteFile($plugindir . $export_ary['uninstallfile'], $data);
     if (is_array($export_ary['Data']['plugin']['__modules'])) {
         foreach ($export_ary['Data']['plugin']['__modules'] as $var) {
             if ($var['modtype'] == 1) {
                 jio()->WriteFile($plugindir . $var['mod_file'] . '.mod.php', $data);
             } elseif ($var['modtype'] == 5) {
                 jio()->WriteFile($plugindir . $var['mod_file'] . '.class.php', $data);
             } else {
                 jio()->WriteFile($plugindir . $var['mod_file'] . '.inc.php', $data);
                 jio()->WriteFile($tempdir . $var['mod_file'] . '.html', '');
             }
         }
     }
     $sql = "DELETE FROM `" . TABLE_PREFIX . "plugin` WHERE `pluginid` =  '{$id}'";
     $result = $this->DatabaseHandler->Query($sql);
     $sql = "DELETE FROM `" . TABLE_PREFIX . "pluginvar` WHERE `pluginid` =  '{$id}'";
     $result = $this->DatabaseHandler->Query($sql);
     $this->Messager("插件发布成功,请进入插件目录<br>" . $plugindir . "<br>编辑相关文件代码,使其具备你所需要的功能!", '', 10);
 }
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:70,代码来源:plugin.mod.php

示例14: uc_serialize

 function uc_serialize($arr, $htmlon = 0)
 {
     return xml_serialize($arr, $htmlon);
 }
开发者ID:noikiy,项目名称:MyShop,代码行数:4,代码来源:uc.php

示例15: error_handler

function error_handler($errno, $errstr, $errfile, $errline)
{
    if (error_reporting() == 0) {
        return;
    }
    $error = array('code' => $errno, 'message' => $errstr, 'file' => $errfile, 'line' => $errline);
    if (@$GLOBALS['debug']) {
        header("Content-Type:text/xml");
        echo "<?xml version='1.0' ?>";
        echo utf8_encode(xml_serialize('error', $error));
    } else {
        error_log(var_export($error, TRUE) . "\n", 3, dirname(__FILE__) . "/errors.log");
        header("HTTP/1.0 500 Internal Error");
    }
    exit;
}
开发者ID:BackupTheBerlios,项目名称:freja-svn,代码行数:16,代码来源:stdinc.php


注:本文中的xml_serialize函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。