• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP xml_serialize函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: serialize

 function serialize($s, $htmlon = 0)
 {
     if (file_exists(UC_ROOT . RELEASE_ROOT . './lib/xml.class.php')) {
         include_once UC_ROOT . RELEASE_ROOT . './lib/xml.class.php';
     } else {
         include_once UC_ROOT . './lib/xml.class.php';
     }
     return xml_serialize($s, $htmlon);
 }
开发者ID:cwcw,项目名称:cms,代码行数:9,代码来源:base.php


示例17: hg_serialize

 private function hg_serialize($s, $htmlon = 0)
 {
     include_once 'xml.class.php';
     return xml_serialize($s, $htmlon);
 }
开发者ID:h3len,项目名称:Project,代码行数:5,代码来源:app.class.php


示例18: getcreditsettings

 public function getcreditsettings(array $get, array $post)
 {
     if (!$this->config['api_getcreditsettings']) {
         return self::API_RETURN_FORBIDDEN;
     }
     $credits = [];
     return xml_serialize($credits);
 }
开发者ID:vergil-lai,项目名称:uc-client,代码行数:8,代码来源:Note.php


示例19: XMLserialize

function XMLserialize($s, $htmlon = 0)
{
    include_once UC_PATH . './xml.class.php';
    return xml_serialize($s, $htmlon);
}
开发者ID:druphliu,项目名称:dzzoffice,代码行数:5,代码来源:fun.php


示例20: _serialize

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP xml_set_character_data_handler函数代码示例发布时间:2022-05-23
下一篇:
PHP xml_safe_fieldname函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap