PHP笔记

来自Jack's Lab
(版本间的差异)
跳转到: 导航, 搜索
(Time)
(Time)
第53行: 第53行:
 
</source>
 
</source>
  
 +
 +
  int time ( void )  // Returns the current time measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).
 
<br><br>
 
<br><br>
  

2018年5月13日 (日) 15:28的版本

目录

1 XML

<?php
$xmldata = <<<XML
<?xml version="1.0" encoding="utf-8" ?>
<root>
<gateway_id>1122</gateway_id>
<data operation="report">
</data>
</root>
XML;

$root = new SimpleXMLElement($xmldata);

echo "Gateway ID: " . $root->gateway_id . "\n";
?>


2 正则表达式

   '/Result:\s*[^0]{1}\s*row.*<table>.*<tr>.+<\/tr>[^<]*<tr\s?>(.+)<\/tr>/s'  -----> *, + 都是最大匹配


适当就好要用 *? 和 +?

   '/Result:\s*[^0]{1}\s*row.*<table>.*?<tr>.+?<\/tr>[^<]*?<tr\s?>(.+?)<\/tr>/s'



3 Time

<?php 
date_default_timezone_set("UTC"); 
echo "UTC:".time();  
echo "<br>"; 

date_default_timezone_set("Asia/Shanghai"); 
echo "Asia/Shanghai:".time(); 
echo "<br>"; 
?> 


UTC:1526196418
Asia/Shanghai:1526196418


 int time ( void )  // Returns the current time measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).



4 资源






















个人工具
名字空间

变换
操作
导航
工具箱