<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></title> 
<link>http://www.jackxiang.com/index.php</link> 
<description><![CDATA[赢在IT，Playin' with IT,Focus on Killer Application,Marketing Meets Technology.]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></copyright>
<item>
<link>http://www.jackxiang.com/post/13224/</link>
<title><![CDATA[[实践OK]awk将一行中的换行去掉，并输出两行一样的内容。]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[Php/Js/Shell/Go]]></category>
<pubDate>Thu, 08 Jan 2026 02:19:06 +0000</pubDate> 
<guid>http://www.jackxiang.com/post/13224/</guid> 
<description>
<![CDATA[ 
	awk &#039;&#123;gsub(/&#92;r&#124;&#92;n/,&quot;&quot;); print $0 &quot;&#92;t&quot; $0&#125;&#039; 工作簿1.csv<br/><br/>一行 awk 搞定：把整行先去掉内部换行，再按原样重复一次即可（默认 FS 已能识别 &#92;t）<br/>awk &#039;&#123;gsub(/&#92;r&#124;&#92;n/,&quot;&quot;); print $0 &quot;&#92;t&quot; $0&#125;&#039; 工作簿1.csv<br/>解释<br/>gsub(/&#92;r&#124;&#92;n/,&quot;&quot;) —— 把记录里所有回车、换行符清掉，保证是一条完整行。<br/>print $0 &quot;&#92;t&quot; $0 —— 整行再拼一次，中间用 &#92;t 分隔，效果就是“原列 1 原列”。
]]>
</description>
</item><item>
<link>http://www.jackxiang.com/post/13018/</link>
<title><![CDATA[[实践OK]Node.js version = v18.17.0  在CentOS7下无法支持？有没有现成的RPM包@CentOS7.9]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[Php/Js/Shell/Go]]></category>
<pubDate>Wed, 23 Jul 2025 07:00:55 +0000</pubDate> 
<guid>http://www.jackxiang.com/post/13018/</guid> 
<description>
<![CDATA[ 
	这篇日志被加密了。请到源地址输入密码后查看。
]]>
</description>
</item><item>
<link>http://www.jackxiang.com/post/12810/</link>
<title><![CDATA[[实践OK]php缺少libonig.so.5或libonig.so.2]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[Php/Js/Shell/Go]]></category>
<pubDate>Sat, 22 Feb 2025 13:32:41 +0000</pubDate> 
<guid>http://www.jackxiang.com/post/12810/</guid> 
<description>
<![CDATA[ 
	ldd /usr/local/php/sbin/php-fpm&#124;grep &quot;not found&quot;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;libonig.so.5 =&gt; not found<br/><br/><br/>rpm -ql oniguruma&#124;grep libonig.so.5<br/>/usr/lib64/libonig.so.5<br/>/usr/lib64/libonig.so.5.0.0<br/><br/>yum install oniguruma<br/>上次元数据过期检查：2:09:39 前，执行于 2025年02月22日 星期六 19时17分44秒。<br/>依赖关系解决。<br/>===================================================<br/> 软件包&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 架构&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs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sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;6.8.2-2.el8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AppStream&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;187 k<br/><br/>事务概要<br/>===================================================<br/>安装&nbsp;&nbsp;1 软件包<br/><br/>总下载：187 k<br/>安装大小：676 k<br/>确定吗？[y/N]： y<br/>下载软件包：<br/>oniguruma-6.8.2-2.el8.x86_64.rpm&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 719 kB/s &#124; 187 kB&nbsp;&nbsp;&nbsp;&nbsp; 00:00&nbsp;&nbsp;&nbsp;&nbsp;<br/>----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------<br/>总计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&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>
]]>
</description>
</item><item>
<link>http://www.jackxiang.com/post/12615/</link>
<title><![CDATA[[实践OK] GO语言中Goroutine 泄露的学习，以及在Go语言中，整个 main 函数中的代码都是在主 goroutine 中执行的。主 goroutine 负责启动程序的执行，并处理后续的逻辑，所以需要用var wg sync.WaitGroup  // 创建 WaitGroup，不能提前退出而确保主 goroutine 等待所有子 goroutine 完成。如果不使用这种方式，主 goroutine 可能在子 goroutine 执行之前就结束，导致某些任务未能完成。]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[Php/Js/Shell/Go]]></category>
<pubDate>Tue, 08 Oct 2024 03:50:54 +0000</pubDate> 
<guid>http://www.jackxiang.com/post/12615/</guid> 
<description>
<![CDATA[ 
	这篇日志被加密了。请到源地址输入密码后查看。
]]>
</description>
</item><item>
<link>http://www.jackxiang.com/post/12440/</link>
<title><![CDATA[[实践OK]PHP正则实现天气预报UL表格及其里面天气信息内容获取。]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[Php/Js/Shell/Go]]></category>
<pubDate>Tue, 18 Jun 2024 07:58:51 +0000</pubDate> 
<guid>http://www.jackxiang.com/post/12440/</guid> 
<description>
<![CDATA[ 
	捕获组与非捕获组概念：https://segmentfault.com/a/1190000021043947<br/>文章中的工具用的正则表达式公式： https://regex101.com/<br/>非捕获部分：(?:.*?&lt;span title=&quot;(.*?)&quot; .*?&lt;&#92;/span&gt;)?<br/><br/><textarea name="code" class="php" rows="15" cols="100">
&lt;?php
&nbsp;&nbsp; $content = &lt;&lt;&lt;EOF
&lt;ul class=&quot;t clearfix&quot;&gt;
&lt;li class=&quot;sky skyid lv2&quot;&gt;
&lt;h1&gt;17日（今天）&lt;/h1&gt;
&lt;big class=&quot;png40&quot;&gt;&lt;/big&gt;
&lt;big class=&quot;png40 n00&quot;&gt;&lt;/big&gt;
&lt;p title=&quot;晴&quot; class=&quot;wea&quot;&gt;晴&lt;/p&gt;
&lt;p class=&quot;tem&quot;&gt;
&lt;i&gt;24℃&lt;/i&gt;
&lt;/p&gt;
&lt;p class=&quot;win&quot;&gt;
&lt;em&gt;
&lt;span title=&quot;西南风&quot; class=&quot;SW&quot;&gt;&lt;/span&gt;
&lt;/em&gt;
&lt;i&gt;&amp;lt;3级&lt;/i&gt;
&lt;/p&gt;
&lt;div class=&quot;slid&quot;&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;sky skyid lv2 on&quot;&gt;
&lt;h1&gt;18日（明天）&lt;/h1&gt;
&lt;big class=&quot;png40 d00&quot;&gt;&lt;/big&gt;
&lt;big class=&quot;png40 n01&quot;&gt;&lt;/big&gt;
&lt;p title=&quot;晴转多云&quot; class=&quot;wea&quot;&gt;晴转多云&lt;/p&gt;
&lt;p class=&quot;tem&quot;&gt;
&lt;span&gt;37℃&lt;/span&gt;/&lt;i&gt;25℃&lt;/i&gt;
&lt;/p&gt;
&lt;p class=&quot;win&quot;&gt;
&lt;em&gt;
&lt;span title=&quot;南风&quot; class=&quot;S&quot;&gt;&lt;/span&gt;
&lt;span title=&quot;南风&quot; class=&quot;S&quot;&gt;&lt;/span&gt;
&lt;/em&gt;
&lt;i&gt;&amp;lt;3级&lt;/i&gt;
&lt;/p&gt;
&lt;div class=&quot;slid&quot;&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;sky skyid lv2&quot;&gt;
&lt;h1&gt;19日（后天）&lt;/h1&gt;
&lt;big class=&quot;png40 d01&quot;&gt;&lt;/big&gt;
&lt;big class=&quot;png40 n02&quot;&gt;&lt;/big&gt;
&lt;p title=&quot;多云转阴&quot; class=&quot;wea&quot;&gt;多云转阴&lt;/p&gt;
&lt;p class=&quot;tem&quot;&gt;
&lt;span&gt;34℃&lt;/span&gt;/&lt;i&gt;25℃&lt;/i&gt;
&lt;/p&gt;
&lt;p class=&quot;win&quot;&gt;
&lt;em&gt;
&lt;span title=&quot;南风&quot; class=&quot;S&quot;&gt;&lt;/span&gt;
&lt;span title=&quot;东南风&quot; class=&quot;SE&quot;&gt;&lt;/span&gt;
&lt;/em&gt;
&lt;i&gt;&amp;lt;3级&lt;/i&gt;
&lt;/p&gt;
&lt;div class=&quot;slid&quot;&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;sky skyid lv2&quot;&gt;
&lt;h1&gt;20日（周四）&lt;/h1&gt;
&lt;big class=&quot;png40 d01&quot;&gt;&lt;/big&gt;
&lt;big class=&quot;png40 n00&quot;&gt;&lt;/big&gt;
&lt;p title=&quot;多云转晴&quot; class=&quot;wea&quot;&gt;多云转晴&lt;/p&gt;
&lt;p class=&quot;tem&quot;&gt;
&lt;span&gt;34℃&lt;/span&gt;/&lt;i&gt;24℃&lt;/i&gt;
&lt;/p&gt;
&lt;p class=&quot;win&quot;&gt;
&lt;em&gt;
&lt;span title=&quot;东南风&quot; class=&quot;SE&quot;&gt;&lt;/span&gt;
&lt;span title=&quot;东风&quot; class=&quot;E&quot;&gt;&lt;/span&gt;
&lt;/em&gt;
&lt;i&gt;&amp;lt;3级&lt;/i&gt;
&lt;/p&gt;
&lt;div class=&quot;slid&quot;&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;sky skyid lv2&quot;&gt;
&lt;h1&gt;21日（周五）&lt;/h1&gt;
&lt;big class=&quot;png40 d01&quot;&gt;&lt;/big&gt;
&lt;big class=&quot;png40 n01&quot;&gt;&lt;/big&gt;
&lt;p title=&quot;多云&quot; class=&quot;wea&quot;&gt;多云&lt;/p&gt;
&lt;p class=&quot;tem&quot;&gt;
&lt;span&gt;33℃&lt;/span&gt;/&lt;i&gt;24℃&lt;/i&gt;
&lt;/p&gt;
&lt;p class=&quot;win&quot;&gt;
&lt;em&gt;
&lt;span title=&quot;东南风&quot; class=&quot;SE&quot;&gt;&lt;/span&gt;
&lt;span title=&quot;南风&quot; class=&quot;S&quot;&gt;&lt;/span&gt;
&lt;/em&gt;
&lt;i&gt;&amp;lt;3级&lt;/i&gt;
&lt;/p&gt;
&lt;div class=&quot;slid&quot;&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;sky skyid lv2&quot;&gt;
&lt;h1&gt;22日（周六）&lt;/h1&gt;
&lt;big class=&quot;png40 d07&quot;&gt;&lt;/big&gt;
&lt;big class=&quot;png40 n01&quot;&gt;&lt;/big&gt;
&lt;p title=&quot;小雨转多云&quot; class=&quot;wea&quot;&gt;小雨转多云&lt;/p&gt;
&lt;p class=&quot;tem&quot;&gt;
&lt;span&gt;31℃&lt;/span&gt;/&lt;i&gt;22℃&lt;/i&gt;
&lt;/p&gt;
&lt;p class=&quot;win&quot;&gt;
&lt;em&gt;
&lt;span title=&quot;东南风&quot; class=&quot;SE&quot;&gt;&lt;/span&gt;
&lt;span title=&quot;东南风&quot; class=&quot;SE&quot;&gt;&lt;/span&gt;
&lt;/em&gt;
&lt;i&gt;&amp;lt;3级&lt;/i&gt;
&lt;/p&gt;
&lt;div class=&quot;slid&quot;&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;sky skyid lv2&quot;&gt;
&lt;h1&gt;23日（周日）&lt;/h1&gt;
&lt;big class=&quot;png40 d01&quot;&gt;&lt;/big&gt;
&lt;big class=&quot;png40 n01&quot;&gt;&lt;/big&gt;
&lt;p title=&quot;多云&quot; class=&quot;wea&quot;&gt;多云&lt;/p&gt;
&lt;p class=&quot;tem&quot;&gt;
&lt;span&gt;31℃&lt;/span&gt;/&lt;i&gt;21℃&lt;/i&gt;
&lt;/p&gt;
&lt;p class=&quot;win&quot;&gt;
&lt;em&gt;
&lt;span title=&quot;东南风&quot; class=&quot;SE&quot;&gt;&lt;/span&gt;
&lt;span title=&quot;东南风&quot; class=&quot;SE&quot;&gt;&lt;/span&gt;
&lt;/em&gt;
&lt;i&gt;&amp;lt;3级&lt;/i&gt;
&lt;/p&gt;
&lt;div class=&quot;slid&quot;&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
EOF;

preg_match(&#039;/&lt;ul class=&quot;t clearfix&quot;&gt;.*?&lt;&#92;/ul&gt;/s&#039;, $content, $result);
$ul = $result[0];
preg_match_all(&#039;/&lt;li.*?&quot;&gt;.*?&lt;&#92;/li&gt;/s&#039;, $ul, $lis);
// 修正后的正则表达式
$pattern = &#039;/&lt;li.*?&gt;.*?&lt;h1&gt;(.*?)&lt;&#92;/h1&gt;.*?&lt;p.*?title=&quot;(.*?)&quot;.*?&gt;(.*?)&lt;&#92;/p&gt;.*?&lt;p class=&quot;tem&quot;&gt;(.*?)&lt;&#92;/p&gt;.*?&lt;p class=&quot;win&quot;&gt;.*?&lt;span title=&quot;(.*?)&quot; .*?&lt;&#92;/span&gt;(?:.*?&lt;span title=&quot;(.*?)&quot; .*?&lt;&#92;/span&gt;)?.*?&lt;i&gt;(.*?)&lt;&#92;/i&gt;.*?&lt;&#92;/li&gt;/s&#039;;
$lst_all = []; // 保存所有的天气
// 解析li的数据
foreach ($lis[0] as $li) &#123;
&nbsp;&nbsp;&nbsp;&nbsp;preg_match($pattern, $li, $matches);
&nbsp;&nbsp;&nbsp;&nbsp;// 匹配结果处理
&nbsp;&nbsp;&nbsp;&nbsp;$temperature = &#039;&#039;;
&nbsp;&nbsp;&nbsp;&nbsp;if (preg_match(&#039;/&lt;span&gt;(.*?)&lt;&#92;/span&gt;&#92;/&lt;i&gt;(.*?)&lt;&#92;/i&gt;/&#039;, $matches[4], $temp_matches)) &#123;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$temperature = $temp_matches[1] . &#039;/&#039; . $temp_matches[2];
&nbsp;&nbsp;&nbsp;&nbsp;&#125; else if (preg_match(&#039;/&lt;i&gt;(.*?)&lt;&#92;/i&gt;/&#039;, $matches[4], $temp_matches)) &#123;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$temperature = $temp_matches[1];
&nbsp;&nbsp;&nbsp;&nbsp;&#125;

&nbsp;&nbsp;&nbsp;&nbsp;$wind = isset($matches[6]) ? $matches[7] . &#039;&nbsp;&nbsp; &#039; . $matches[5] . &#039;&nbsp;&nbsp;&#039; . $matches[6] : $matches[7] . &#039; &#039; . $matches[5];
&nbsp;&nbsp;&nbsp;&nbsp;$lst_one = [$matches[1], $matches[3], $temperature, $wind];
&nbsp;&nbsp;&nbsp;&nbsp;$lst_all[] = $lst_one;
&#125;
print_r($lst_all);
</textarea><br/><br/><br/>对天气中的温度和风力有时间只有一个温度和风力的情况的判断算法：<br/>温度部分：<br/>&nbsp;&nbsp;&nbsp;&nbsp;$temperature = &#039;&#039;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;if (preg_match(&#039;/&lt;span&gt;(.*?)&lt;&#92;/span&gt;&#92;/&lt;i&gt;(.*?)&lt;&#92;/i&gt;/&#039;, $matches[4], $temp_matches)) &#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$temperature = $temp_matches[1] . &#039;/&#039; . $temp_matches[2];<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#125; else if (preg_match(&#039;/&lt;i&gt;(.*?)&lt;&#92;/i&gt;/&#039;, $matches[4], $temp_matches)) &#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$temperature = $temp_matches[1];<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#125;<br/><br/>风力部分：<br/>问ChatGPT：我只想知道正则如何匹配到下面这段的：<br/><br/>&lt;p class=&quot;win&quot;&gt;<br/>&lt;em&gt;<br/>&lt;span title=&quot;南风&quot; class=&quot;S&quot;&gt;&lt;/span&gt;<br/>&lt;span title=&quot;南风&quot; class=&quot;S&quot;&gt;&lt;/span&gt;<br/>&lt;/em&gt;<br/>&lt;i&gt;&amp;lt;3级&lt;/i&gt;<br/>&lt;/p&gt;<br/>对下面这段正则作下解释：<br/><br/>&lt;p class=&quot;win&quot;&gt;.*?&lt;span title=&quot;(.*?)&quot; .*?&lt;&#92;/span&gt;(?:.*?&lt;span title=&quot;(.*?)&quot; .*?&lt;&#92;/span&gt;)?<br/>上面第一个.*?是非贪婪匹配它后面的：&lt;span title=。<br/>上在第二个(.*?)是匹配南风。<br/>上在第三个.*?是非贪婪匹配它后面的：&lt;&#92;/span&gt;。<br/>是对的吧？<br/>二、最想知道的是：<br/>(?:.?&lt;span title=&quot;(.?)&quot; .?&lt;/span&gt;)?<br/>上在这段正则里面的：?:.? 是想干嘛的呢？<br/>它最后的问号是用来匹配0次或1次用的，这个是这么理解吧。<br/><br/>ChatGPT回答如下：<br/>你说得基本是对的。让我逐步解释一下你提到的正则表达式是如何匹配 `&lt;p class=&quot;win&quot;&gt;` 这段 HTML 代码的，以及 `(?:.*?&lt;span title=&quot;(.*?)&quot; .*?&lt;&#92;/span&gt;)?` 这部分正则表达式的具体作用。<br/><br/>### 1. 正则表达式整体<br/><br/>```regex<br/>&lt;p class=&quot;win&quot;&gt;.*?&lt;span title=&quot;(.*?)&quot; .*?&lt;&#92;/span&gt;(?:.*?&lt;span title=&quot;(.*?)&quot; .*?&lt;&#92;/span&gt;)?<br/>```<br/><br/>#### 1.1. `&lt;p class=&quot;win&quot;&gt;.*?&lt;span title=&quot;(.*?)&quot; .*?&lt;&#92;/span&gt;`<br/><br/>- `&lt;p class=&quot;win&quot;&gt;`: 匹配 `&lt;p&gt;` 标签的开头部分，class 属性为 `win`。<br/>- `.*?`: 非贪婪模式匹配任意字符，尽量少的字符，直到遇到 `&lt;span title=`。<br/>- `&lt;span title=&quot;(.*?)&quot;`: 匹配第一个 `span` 标签，并捕获 `title` 属性的值。`(.*?)` 是一个非贪婪模式的捕获组，匹配 `title` 属性的内容，这里会匹配到 `南风`。<br/>- ` .*?&lt;&#92;/span&gt;`: 非贪婪模式匹配任意字符，直到遇到 `&lt;/span&gt;`。<br/><br/>这一部分的正则表达式解释如下：<br/>- `&lt;p class=&quot;win&quot;&gt;` 精确匹配标签的开始部分。<br/>- `.*?` 尽量少的匹配任意字符，直到遇到 `&lt;span title=`。<br/>- `&lt;span title=&quot;(.*?)&quot;` 匹配 `span` 标签的 `title` 属性，捕获组 `(.*?)` 非贪婪模式匹配 `title` 的内容，即 `南风`。<br/>- ` .*?&lt;&#92;/span&gt;` 匹配从 `title` 属性结束到 `&lt;/span&gt;` 标签结束的所有字符。<br/><br/>#### 1.2. `(?:.*?&lt;span title=&quot;(.*?)&quot; .*?&lt;&#92;/span&gt;)?`<br/><br/>- `(?: ... )`: 非捕获组，匹配括号内的内容，但不捕获它。<br/>- `.*?`: 非贪婪模式匹配任意字符，尽量少的字符，直到遇到 `&lt;span title=`。<br/>- `&lt;span title=&quot;(.*?)&quot;`: 匹配第二个 `span` 标签，并捕获 `title` 属性的值。`(.*?)` 是一个非贪婪模式的捕获组，匹配 `title` 属性的内容，这里会匹配到第二个 `南风`。<br/>- ` .*?&lt;&#92;/span&gt;`: 非贪婪模式匹配任意字符，直到遇到 `&lt;/span&gt;`。<br/>- `?`: 匹配前面的非捕获组 0 次或 1 次。即这部分是可选的。<br/><br/>这一部分的正则表达式解释如下：<br/>- `(?: ... )` 表示一个非捕获组，不会保存匹配结果。<br/>- `.*?` 尽量少的匹配任意字符，直到遇到 `&lt;span title=`。<br/>- `&lt;span title=&quot;(.*?)&quot;` 匹配 `span` 标签的 `title` 属性，捕获组 `(.*?)` 非贪婪模式匹配 `title` 的内容，即第二个 `南风`。<br/>- ` .*?&lt;&#92;/span&gt;` 匹配从 `title` 属性结束到 `&lt;/span&gt;` 标签结束的所有字符。<br/>- `?` 表示这个非捕获组是可选的，可以匹配 0 次或 1 次。<br/><br/>### 2. 匹配示例<br/><br/>以你提供的 HTML 代码为例：<br/><br/>```html<br/>&lt;p class=&quot;win&quot;&gt;<br/>&lt;em&gt;<br/>&lt;span title=&quot;南风&quot; class=&quot;S&quot;&gt;&lt;/span&gt;<br/>&lt;span title=&quot;南风&quot; class=&quot;S&quot;&gt;&lt;/span&gt;<br/>&lt;/em&gt;<br/>&lt;i&gt;&amp;lt;3级&lt;/i&gt;<br/>&lt;/p&gt;<br/>```<br/><br/>- `&lt;p class=&quot;win&quot;&gt;`: 匹配 `&lt;p class=&quot;win&quot;&gt;`。<br/>- `.*?`: 非贪婪模式匹配任意字符，直到遇到 `&lt;span title=`。匹配到 `&#92;n&lt;em&gt;&#92;n`。<br/>- `&lt;span title=&quot;(.*?)&quot;`: 匹配 `&lt;span title=&quot;南风&quot;` 并捕获 `title` 属性的值 `南风`。<br/>- ` .*?&lt;&#92;/span&gt;`: 匹配 `class=&quot;S&quot;&gt;&lt;/span&gt;&#92;n`。<br/><br/>接下来是可选部分：<br/><br/>- `(?:.*?&lt;span title=&quot;(.*?)&quot; .*?&lt;&#92;/span&gt;)?`: <br/>&nbsp;&nbsp;- `.*?`: 非贪婪模式匹配任意字符，直到遇到 `&lt;span title=`。匹配到 `&#92;n`。<br/>&nbsp;&nbsp;- `&lt;span title=&quot;(.*?)&quot;`: 匹配 `&lt;span title=&quot;南风&quot;` 并捕获 `title` 属性的值 `南风`。<br/>&nbsp;&nbsp;- ` .*?&lt;&#92;/span&gt;`: 匹配 `class=&quot;S&quot;&gt;&lt;/span&gt;&#92;n`。<br/>&nbsp;&nbsp;- `?`: 表示这个部分是可选的，可以匹配 0 次或 1 次。这次匹配到 1 次。<br/><br/>### 总结<br/><br/>- `&lt;p class=&quot;win&quot;&gt;.*?&lt;span title=&quot;(.*?)&quot; .*?&lt;&#92;/span&gt;`: 匹配 `&lt;p class=&quot;win&quot;&gt;` 开始标签，直到第一个 `span` 标签的 `title` 属性，并捕获其值。<br/>- `(?:.*?&lt;span title=&quot;(.*?)&quot; .*?&lt;&#92;/span&gt;)?`: 匹配从第一个 `span` 标签结束到第二个 `span` 标签结束的内容，并捕获第二个 `span` 标签的 `title` 属性，整个部分是可选的。<br/>- `?` 表示前面的非捕获组是可选的，可以出现 0 次或 1 次。<br/><br/><br/><br/>再对正则知识点细节性问：<br/>(?: ... ) 表示一个非捕获组，不会保存匹配结果。<br/>上面这个是什么意思，请再接合解释下面正则：<br/>(?:.?&lt;span title=&quot;(.?)&quot; .*?&lt;/span&gt;)?<br/><br/>ChatGPT回答：<br/>好的，让我们详细解释一下 `(?: ... )` 和具体的正则表达式 `(?:.*?&lt;span title=&quot;(.*?)&quot; .*?&lt;&#92;/span&gt;)?`。<br/><br/>### 非捕获组 `(?: ... )`<br/><br/>- `(?: ... )` 是一个**非捕获组**，它的作用是将括号内的内容进行分组，但不保存这个组的匹配结果。这和普通的捕获组 `(...)` 不同，普通捕获组会保存匹配结果供后续引用，而非捕获组则不会保存。<br/>- 非捕获组主要用于在需要进行分组但不希望保存匹配结果的情况下，这样可以节省内存，并且在使用正则表达式时不需要担心额外的捕获组会影响捕获组编号。<br/><br/>### 具体的正则表达式 `(?:.*?&lt;span title=&quot;(.*?)&quot; .*?&lt;&#92;/span&gt;)?`<br/><br/>#### 分解解释<br/><br/>1. **`(?: ... )`**:<br/>&nbsp;&nbsp; - 这是一个非捕获组，括号内的内容会被当作一个整体来处理，但不会保存匹配结果。<br/><br/>2. **`.*?`**:<br/>&nbsp;&nbsp; - 非贪婪模式匹配任意字符，尽量少的字符，直到遇到 `&lt;span title=`。<br/>&nbsp;&nbsp; - 这里匹配的是从 `&lt;p class=&quot;win&quot;&gt;` 到第一个 `&lt;span title=&quot;...&quot;&gt;` 之间的任意字符，包括换行符等。<br/><br/>3. **`&lt;span title=&quot;(.*?)&quot;`**:<br/>&nbsp;&nbsp; - 匹配 `&lt;span title=&quot;` 字符串，并捕获 `title` 属性的值。<br/>&nbsp;&nbsp; - `(.*?)` 是一个非贪婪模式的捕获组，匹配 `title` 属性的内容。例如，`南风`。<br/><br/>4. **` .*?&lt;&#92;/span&gt;`**:<br/>&nbsp;&nbsp; - 非贪婪模式匹配任意字符，直到遇到 `&lt;/span&gt;`。<br/>&nbsp;&nbsp; - 这里匹配的是从 `title` 属性结束到 `&lt;/span&gt;` 标签结束的所有字符。<br/><br/>5. **`(?: ... )?`**:<br/>&nbsp;&nbsp; - 问号 `?` 表示前面的非捕获组是可选的，可以匹配 0 次或 1 次。<br/>&nbsp;&nbsp; - 整个非捕获组 `(?: ... )` 是可选的，意味着可以有一个额外的 `span` 标签，或者没有。<br/><br/>#### 具体示例<br/><br/>以你的 HTML 代码为例：<br/><br/>```html<br/>&lt;p class=&quot;win&quot;&gt;<br/>&lt;em&gt;<br/>&lt;span title=&quot;南风&quot; class=&quot;S&quot;&gt;&lt;/span&gt;<br/>&lt;span title=&quot;南风&quot; class=&quot;S&quot;&gt;&lt;/span&gt;<br/>&lt;/em&gt;<br/>&lt;i&gt;&amp;lt;3级&lt;/i&gt;<br/>&lt;/p&gt;<br/>```<br/><br/>匹配过程如下：<br/><br/>1. **第一部分** `&lt;p class=&quot;win&quot;&gt;.*?&lt;span title=&quot;(.*?)&quot; .*?&lt;&#92;/span&gt;`:<br/>&nbsp;&nbsp; - 匹配 `&lt;p class=&quot;win&quot;&gt;` 开始标签。<br/>&nbsp;&nbsp; - `.*?` 非贪婪模式匹配任意字符，直到遇到第一个 `&lt;span title=`。<br/>&nbsp;&nbsp; - 匹配并捕获第一个 `span` 标签的 `title` 属性值 `南风`。<br/>&nbsp;&nbsp; - 匹配 `&lt;/span&gt;` 标签。<br/><br/>2. **第二部分** `(?:.*?&lt;span title=&quot;(.*?)&quot; .*?&lt;&#92;/span&gt;)?`:<br/>&nbsp;&nbsp; - `(?: ... )` 非捕获组，将内容作为整体处理。<br/>&nbsp;&nbsp; - `.*?` 非贪婪模式匹配任意字符，直到遇到第二个 `&lt;span title=`。<br/>&nbsp;&nbsp; - 匹配并捕获第二个 `span` 标签的 `title` 属性值 `南风`。<br/>&nbsp;&nbsp; - 匹配 `&lt;/span&gt;` 标签。<br/>&nbsp;&nbsp; - `?` 表示非捕获组是可选的，可以匹配 0 次或 1 次。<br/><br/>### 完整正则表达式的匹配过程<br/><br/>完整的正则表达式 `(?:.*?&lt;span title=&quot;(.*?)&quot; .*?&lt;&#92;/span&gt;)?` 在匹配过程中的作用如下：<br/><br/>1. 从 `&lt;p class=&quot;win&quot;&gt;` 开始，匹配任意字符直到第一个 `&lt;span title=`。<br/>2. 捕获第一个 `span` 标签的 `title` 属性值。<br/>3. 匹配 `&lt;/span&gt;` 标签。<br/>4. 非捕获组 `(?: ... )?` 的内容（可选）：<br/>&nbsp;&nbsp; - 匹配任意字符直到第二个 `&lt;span title=`。<br/>&nbsp;&nbsp; - 捕获第二个 `span` 标签的 `title` 属性值。<br/>&nbsp;&nbsp; - 匹配 `&lt;/span&gt;` 标签。<br/><br/>这段正则表达式会成功匹配以下内容，并分别捕获两个 `span` 标签的 `title` 属性值：<br/><br/>```html<br/>&lt;p class=&quot;win&quot;&gt;<br/>&lt;em&gt;<br/>&lt;span title=&quot;南风&quot; class=&quot;S&quot;&gt;&lt;/span&gt;<br/>&lt;span title=&quot;南风&quot; class=&quot;S&quot;&gt;&lt;/span&gt;<br/>&lt;/em&gt;<br/>&lt;i&gt;&amp;lt;3级&lt;/i&gt;<br/>&lt;/p&gt;<br/>```<br/><br/>结果是捕获两个 `span` 标签的 `title` 属性值 `南风` 和 `南风`。如果只有一个 `span` 标签，那么也能成功匹配，只会捕获第一个 `title` 属性值。<br/><br/>
]]>
</description>
</item><item>
<link>http://www.jackxiang.com/post/12299/</link>
<title><![CDATA[[实践OK]php的round函数实现将微秒转换为毫秒]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[Php/Js/Shell/Go]]></category>
<pubDate>Sat, 09 Mar 2024 12:20:44 +0000</pubDate> 
<guid>http://www.jackxiang.com/post/12299/</guid> 
<description>
<![CDATA[ 
	<br/>$date = microtime(true);// 返回浮点数，小数点前面是当前时间的时间戳，小数点后为当前时间的微秒<br/>var_dump($date);<br/>// 输出：float(1566897763.0927)<br/><br/><br/><br/>PHP的round函数用于四舍五入浮点数。它的作用是返回最接近一个数字的整数，也可以指定小数点后的位数。例如：<br/><br/>$float = 3.14159;<br/>$rounded = round($float, 2); // 返回 3.14<br/>$rounded = round($float); // 返回 3<br/><br/><br/>要求：timestamp 时间戳 ：&quot;timestamp&quot;: &quot;1709986011923&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#13位的毫秒数，时间戳(精确到毫秒)，当前时间5分钟内请求有效<br/>实现：<br/> cat sendmsg_2.php<br/><textarea name="code" class="php" rows="15" cols="100">
&lt;?php
function generate_timestamp_milliseconds() &#123;
&nbsp;&nbsp;&nbsp;&nbsp;$timestamp = microtime(true); // 获取当前Unix时间戳，包括微秒
&nbsp;&nbsp;&nbsp;&nbsp;echo $timestamp.&quot;&#92;n&quot;;
&nbsp;&nbsp;&nbsp;&nbsp;$milliseconds = round($timestamp * 1000); // 转换为毫秒
&nbsp;&nbsp;&nbsp;&nbsp;return $milliseconds;
&#125;
echo generate_timestamp_milliseconds();


</textarea><br/>php sendmsg_2.php <br/>1709986816.8926&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #获取当前Unix时间戳，包括微秒&nbsp;&nbsp;<br/>1709986816893&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#转换为毫秒<br/><br/>
]]>
</description>
</item><item>
<link>http://www.jackxiang.com/post/12080/</link>
<title><![CDATA[[实践OK]PHP的CURL支持302/301的跳转的代码写法和Shell下的Curl参数-L实现跳转。]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[Php/Js/Shell/Go]]></category>
<pubDate>Sat, 28 Oct 2023 16:08:43 +0000</pubDate> 
<guid>http://www.jackxiang.com/post/12080/</guid> 
<description>
<![CDATA[ 
	问题：<br/>php的这段代码，不支持访问http时redirect到https，如：<br/>访问：http://jtgl.beijing.gov.cn/jgj/lszt/659722/660341/index.html<br/>307 Temporary Redirect导到：https://jtgl.beijing.gov.cn/jgj/lszt/659722/660341/index.html<br/><br/>请将该函数修改成能自动导到https并获取到相应body内容:<br/>//发起https的get请求<br/>function https_get($url,$timeout=120)&#123;<br/>&nbsp;&nbsp; $curl = curl_init();<br/>&nbsp;&nbsp; curl_setopt($curl, CURLOPT_URL, $url);<br/>&nbsp;&nbsp; curl_setopt($curl, CURLOPT_HEADER, 0);<br/>&nbsp;&nbsp; curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);<br/>&nbsp;&nbsp; curl_setopt($curl, CURLOPT_TIMEOUT,$timeout);<br/>&nbsp;&nbsp; curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);&nbsp;&nbsp;// 跳过检查&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp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p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&#125;&nbsp;&nbsp;<br/><br/>回答：<br/>要在PHP中自动将HTTP请求重定向到HTTPS并获取响应内容，您可以使用curl来检测HTTP响应头中的重定向，然后执行相应的HTTPS请求。以下是修改后的函数示例：<br/><br/>function https_get($url, $timeout = 120) &#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$curl = curl_init();<br/>&nbsp;&nbsp;&nbsp;&nbsp;curl_setopt($curl, CURLOPT_URL, $url);<br/>&nbsp;&nbsp;&nbsp;&nbsp;curl_setopt($curl, CURLOPT_HEADER, true);<br/>&nbsp;&nbsp;&nbsp;&nbsp;curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);<br/>&nbsp;&nbsp;&nbsp;&nbsp;curl_setopt($curl, CURLOPT_TIMEOUT, $timeout);<br/>&nbsp;&nbsp;&nbsp;&nbsp;curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);<br/>&nbsp;&nbsp;&nbsp;&nbsp;curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);<br/>&nbsp;&nbsp;&nbsp;&nbsp;curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); // 启用重定向跟随<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;$response = curl_exec($curl);<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);<br/>&nbsp;&nbsp;&nbsp;&nbsp;if ($httpCode == 301 &#124;&#124; $httpCode == 302) &#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$matches = array();<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;preg_match(&#039;/Location:(.*?)&#92;n/&#039;, $response, $matches);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$newUrl = trim(array_pop($matches));<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (!empty($newUrl)) &#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;curl_setopt($curl, CURLOPT_URL, $newUrl);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$response = curl_exec($curl);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#125;<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;curl_close($curl);<br/>&nbsp;&nbsp;&nbsp;&nbsp;return $response;<br/>&#125;<br/><br/>$url = &quot;http://jtgl.beijing.gov.cn/jgj/lszt/659722/660341/index.html&quot;;<br/>$response = https_get($url);<br/>echo $response;<br/><br/><br/>php -a 测试是OK的。<br/><br/><br/><br/><br/>问题二：那直接在shell下用curl命令实现上面307的Location转向获取到转向后的内容，用什么参数实现呢？我记得好像是有相应参数的。<br/>是的，您可以使用`curl`命令行工具来获取重定向后的内容。要实现HTTP 307重定向的自动跟随，您可以使用`-L`或`--location`参数，这会让`curl`自动跟随重定向并获取最终的内容。下面是示例：<br/><textarea name="code" class="php" rows="15" cols="100">
curl -L http://jtgl.beijing.gov.cn/jgj/lszt/659722/660341/index.html
</textarea><br/><br/>使用`-L`参数，`curl`将自动处理HTTP 307 Temporary Redirect，并获取最终的内容。<br/><br/>3XX response code<br/><br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -L, --location<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(HTTP) If the server reports that the requested page has moved to a different location (indicated with a Location: header and a 3XX response code), this option will make<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;curl redo the request on the new place. If used together with -i, --include or -I, --head, headers from all requested pages will be shown. When authentication is used, curl<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;only sends its credentials to the initial host. If a redirect takes curl to a different host, it will not be able to intercept the user+password. See also --location-<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;trusted on how to change this. You can limit the amount of redirects to follow by using the --max-redirs option.
]]>
</description>
</item><item>
<link>http://www.jackxiang.com/post/11915/</link>
<title><![CDATA[[实践OK]go-cyclic 循环依赖解决工具，解决import cycle not allowed。]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[Php/Js/Shell/Go]]></category>
<pubDate>Fri, 07 Jul 2023 01:58:07 +0000</pubDate> 
<guid>http://www.jackxiang.com/post/11915/</guid> 
<description>
<![CDATA[ 
	import cycle not allowed<br/>而且如果项目很大的时候，一个包下面有很多 .go 文件，只提示包与包的循环引用（如上图），是很难定位到哪个 .go 文件和哪个 .go 文件直接进行了循环引用，难以排查。<br/><br/>go-cyclic run --dir&nbsp;&nbsp;~/go_learning/src/pdfwatcher.src.cctv.cn<br/>Failed. 1 circular dependence chains were found.<br/><br/>┌---→&nbsp;&nbsp;/Users/jackXiang/go_learning/src/pdfwatcher.src.cctv.cn/Requests/Request.go<br/>┆&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ↓<br/>└---&nbsp;&nbsp;&nbsp;&nbsp; /Users/jackXiang/go_learning/src/pdfwatcher.src.cctv.cn/Loger/Loger.go<br/><br/><br/>安装：<br/>go install github.com/elza2/go-cyclic@latest<br/>go: downloading github.com/elza2/go-cyclic v1.1.0<br/>go: downloading github.com/fatih/color v1.15.0<br/>go: downloading golang.org/x/mod v0.8.0<br/>go: downloading github.com/urfave/cli/v2 v2.24.4<br/>go: downloading github.com/mattn/go-isatty v0.0.17<br/>go: downloading github.com/mattn/go-colorable v0.1.13<br/>go: downloading golang.org/x/sys v0.6.0<br/>go: downloading github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673<br/>go: downloading github.com/cpuguy83/go-md2man/v2 v2.0.2<br/>go: downloading github.com/russross/blackfriday/v2 v2.1.0<br/><br/><br/><br/>来自：https://link.zhihu.com/?target=https%3A//github.com/elza2/go-cyclic
]]>
</description>
</item><item>
<link>http://www.jackxiang.com/post/11785/</link>
<title><![CDATA[[实践OK]PHP检测当前字符编码并转码]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[Php/Js/Shell/Go]]></category>
<pubDate>Sun, 16 Apr 2023 03:59:50 +0000</pubDate> 
<guid>http://www.jackxiang.com/post/11785/</guid> 
<description>
<![CDATA[ 
	Windows上用curl -d&quot;&quot; 上传的编码是：EUC-CN<br/>curl -d&quot;向东阳 向守仁&quot;&nbsp;&nbsp;XXX.XXXX.com<br/>EUC-CN<br/><br/><textarea name="code" class="php" rows="15" cols="100">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$textcontents = trim(key($_POST));
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$encode = mb_detect_encoding($textcontents, array(&quot;ASCII&quot;,&#039;UTF-8&#039;,&quot;GB2312&quot;,&quot;GBK&quot;,&#039;BIG5&#039;));
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(&quot;UTF-8&quot; != $encode)&#123;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $textcontents = mb_convert_encoding($textcontents, &#039;UTF-8&#039;, $encode);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125;
</textarea><br/><br/><br/>来自：https://blog.csdn.net/wuxianbing2012/article/details/79727259
]]>
</description>
</item><item>
<link>http://www.jackxiang.com/post/11626/</link>
<title><![CDATA[[解决方案]macbook下面root使用ln：无法创建符号链接/usr/bin/python：权限不够，MAC /usr/bin/目录下 Operation not permitted的解决。]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[Php/Js/Shell/Go]]></category>
<pubDate>Sun, 04 Dec 2022 17:02:12 +0000</pubDate> 
<guid>http://www.jackxiang.com/post/11626/</guid> 
<description>
<![CDATA[ 
	Mac系统 解决 python: No such file or directory<br/>ln -s -f /usr/local/bin/python3.9 /usr/local/bin/python&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br/>python&nbsp;&nbsp;#无法解决<br/>zsh: no such file or directory: /usr/local/Cellar/python@3.9/3.9.13_3/bin/python3.9 #在PATH里面有上面的软链接，但还是指向这个最新的py地址<br/>/usr/local/bin/runlike&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #得把它加到环境变量中去没用，还是指向上面最新的。<br/>which python<br/>python: aliased to /usr/local/Cellar/python@3.9/3.9.13_3/bin/python3.9&nbsp;&nbsp;#aliased指向了最新的<br/>果然如此，vim ~/.zshrc：<br/>alias python=&quot;/usr/local/Cellar/python@3.9/3.9.13_3/bin/python3.9&quot;<br/>alias pip=&quot;/usr/local/Cellar/python@3.9/3.9.13_3/bin/pip3.9&quot;<br/>alias pip3=&quot;/usr/local/Cellar/python@3.8/3.8.9/bin/pip3.8&quot;<br/>alias pip3.8=&quot;/usr/local/Cellar/python@3.8/3.8.9/bin/pip3.8&quot;<br/>alias pip3.9=&quot;/usr/local/Cellar/python@3.9/3.9.13_3/bin/pip3.9&quot;<br/><br/>修改为就好了：<br/>alias python=&quot;/usr/local/Cellar/python@3.9/3.9.14/bin/python3.9&quot;<br/>alias pip=&quot;/usr/local/Cellar/python@3.9/3.9.14/bin/pip3.9&quot;<br/>alias pip3=&quot;/usr/local/Cellar/python@3.9/3.9.14/bin/pip3.9&quot;<br/>alias pip3.8=&quot;/usr/local/Cellar/python@3.9/3.9.14/bin/pip3.9&quot;<br/>alias pip3.9=&quot;/usr/local/Cellar/python@3.9/3.9.14/bin/pip3.9&quot;<br/><br/>ls /usr/local/Cellar/python@3.9/3.9.13_3/bin/python3.9<br/>ls: /usr/local/Cellar/python@3.9/3.9.13_3/bin/python3.9: No such file or directory #因升级更新Mac新版本系统后没有了。<br/><br/>位置：/usr/bin&nbsp;&nbsp; sudo cp -rf python3 python<br/>cp: python: Operation not permitted<br/><br/>ln -s&nbsp;&nbsp;/usr/bin/python3 /usr/bin/python<br/>ln: /usr/bin/python: Operation not permitted<br/><br/><br/><br/><br/><br/>原因：系统保护机制<br/>Disabling SIP<br/>It&#039;s also possible to disable System Integrity Protection, but it&#039;s generally best to leave it on and do customization in more appropriate locations.<br/>https://stackoverflow.com/questions/36730549/cannot-create-a-symlink-inside-of-usr-bin-even-as-sudo<br/><br/>Restart the system -&gt; long press cmd + R.&nbsp;&nbsp;select a terminal from utilities menu type the following command csrutil disable close terminal and restart system.<br/><br/>来自：https://stackoverflow.com/questions/36730549/cannot-create-a-symlink-inside-of-usr-bin-even-as-sudo<br/><br/>MAC /usr/bin/目录下 Operation not permitted的解决<br/>mac系统下的Rootless机制，让我们在root权限下也不能随心所欲的读写所有路径了，特殊情况下我们需要关闭Rootless时，可尝试如下操作：<br/>1. 重启按住 Command+R，进入恢复模式，打开Terminal。<br/>2. 键入命令 csrutil disable<br/>3. reboot<br/>Rootless机制是对抗恶意程序的最后防线，除非特殊需要时我们才将其关闭，否则保持开启状态<br/>csrutil enable<br/><br/>原文链接：https://blog.csdn.net/king457757706/article/details/70671250
]]>
</description>
</item>
</channel>
</rss>