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


PHP SimpleXMLIterator::asXML方法代码示例

本文整理汇总了PHP中SimpleXMLIterator::asXML方法的典型用法代码示例。如果您正苦于以下问题:PHP SimpleXMLIterator::asXML方法的具体用法?PHP SimpleXMLIterator::asXML怎么用?PHP SimpleXMLIterator::asXML使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SimpleXMLIterator的用法示例。


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

示例1: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $fileInfo = new \SplFileInfo($this->getContainer()->getParameter('kernel.root_dir') . '/../web/sitemap.xml');
     if ($fileInfo->isFile() && $fileInfo->isReadable()) {
         $output->write('Reading sitemap.xml...');
         $file = $fileInfo->openFile();
         $xml = '';
         while (!$file->eof()) {
             $xml .= $file->fgets();
         }
         $output->writeln(' done.');
         $output->write('Updating sitemap.xml...');
         $sitemap = new \SimpleXMLIterator($xml);
         $sitemap->rewind();
         $lastmodDate = new \DateTime();
         $lastmodDate->sub(new \DateInterval('P1D'));
         $lastmodDateFormatted = $lastmodDate->format('Y-m-d');
         while ($sitemap->valid()) {
             $sitemap->current()->lastmod = $lastmodDateFormatted;
             $sitemap->next();
         }
         $file = $file->openFile('w');
         $file->fwrite($sitemap->asXML());
         $output->writeln(' done.');
     } else {
         $output->writeln('Error: Cannot open file web/sitemap.xml');
     }
 }
开发者ID:Quiss,项目名称:Evrika,代码行数:28,代码来源:UpdateSitemapCommand.php

示例2: asXML

 public function asXML($filename = null)
 {
   if (!$this->_iso()) return $filename ? parent::asXML($filename) : parent::asXML();
   $xml = @parent::asXML();
   $xml = utf8_decode($xml);
   if ($filename) file_put_contents($filename, $xml);
   return $xml;
 }
开发者ID:neves,项目名称:qi,代码行数:8,代码来源:element.php

示例3: getFormUploadFields

 /**
  * get files to be uploaded
  * @param object \SimpleXMLIterator $data data
  * @return array
  */
 public function getFormUploadFields($data)
 {
     $data = new \SimpleXMLIterator($data->asXML());
     if (isset($data->values->values->formId)) {
         $object = new \stdClass();
         $object->id = $data->values->values->formId;
         $object->fields = array('xmlDefinition');
         $res = $this->getOne($object);
         $formXml = file_get_contents('/var/www/htdocs/uploads/' . $res['fields']['xmlDefinition']);
         $formXml = new \SimpleXMLIterator($formXml);
         $uploadsFields = $formXml->xpath('//input[@type="file"]');
         foreach ($uploadsFields as $field) {
             $controlName = (string) $field['name'];
             $control = $data->xpath('//' . $controlName);
             $fieldAnswers[] = array('fieldName' => $controlName, 'value' => (string) $control[0]);
         }
         return array('fields' => $fieldAnswers);
     } else {
         return false;
     }
 }
开发者ID:EngrHaiderAli,项目名称:movein-servie,代码行数:26,代码来源:FormConfig.php

示例4: updateAPP

 protected function updateAPP()
 {
     if (is_file($this->applist) && is_writable($this->applist)) {
         try {
             $doc = new SimpleXMLIterator($this->applist, null, true);
         } catch (Exception $e) {
             $this->error[] = "发生异常:" . $e->getMessage() . "  文件:" . $e->getFile() . "  行号:" . $e->getLine();
             return false;
         }
         if ($doc->getName() != "apps") {
             $this->error[] = "applist.xml的根元素必须是apps";
             return false;
         }
         $i = $doc->count();
         if ($i !== 0) {
             $apps = $doc->app;
             foreach ($apps as $app) {
                 if ($app['name'] == $this->app_name) {
                     $this->error[] = "项目列表存在重名项目,请修改项目名称";
                     return false;
                 }
             }
         }
         $doc->addChild("app");
         $doc->app[$i]->addAttribute("name", $this->app_name);
         $doc->app[$i]->addAttribute("path", $this->app_path);
         $doc->app[$i]->addAttribute("index", $this->app_index);
         if ($doc->asXML($this->applist)) {
             return true;
         } else {
             $this->error[] = "TinkPHP助手/data/applist.xml 写入失败";
             return false;
         }
     } else {
         $this->error[] = "TinkPHP助手/data/applist.xml不存在";
         return false;
     }
 }
开发者ID:sdgdsffdsfff,项目名称:TPhelper,代码行数:38,代码来源:AdminAction.class.php


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