Hongmu Notes
Home Practical Collection Python converts Markdown to HTML.
Practical Collection Utility tools

Python converts Markdown to HTML.

Python converts Markdown to HTML.

Python converts Markdown to HTML; the file format can be customized.

After running the script, two directories – `md` and `html` – will be automatically created; the files that need to be converted should be placed within the `md` directory.

The converted file will be placed in the `html` directory!

The software generates logs, which you can review to see the conversion details!

Convert Effect View

Before conversion Markdown:

<<<标题:php二维数组去重函数:标题>>>

以下是一个基于PHP的二维数组去重函数:

```php
function array_unique_multi($array){
    $result = array_map("unserialize", array_unique(array_map("serialize", $array)));
    foreach ($result as $key => $value){
        if ( is_array($value) ){
            $result[$key] = array_unique_multi($value);
        }
    }
    return $result;
}
```

这个函数首先使用`serialize()`和`unserialize()`函数将二维数组中的每个子数组序列化和反序列化,以便于进行数组去重。然后调用`array_unique()`函数对序列化后的数组进行去重,并使用`array_map()`函数将去重后的序列化数组映射回原数组。最后再使用递归的方式对子数组进行去重,直到所有子数组都没有重复元素。

使用该函数示例:

```php
$array = array(
    array(1, 2, 3),
    array(1, 2, 3),
    array(4, 5, 6),
    array(4, 5, 6),
    array(
        array(7, 8, 9),
        array(10, 11, 12),
        array(7, 8, 9)
    ),
    array(
        array(7, 8, 9),
        array(10, 11, 12),
        array(13, 14, 15)
    )
);

$result = array_unique_multi($array);
print_r($result);
```

输出结果:

```
Array
(
    [0] => Array
        (
            [0] => 1
            [1] => 2
            [2] => 3
        )

    [2] => Array
        (
            [0] => 4
            [1] => 5
            [2] => 6
        )

    [4] => Array
        (
            [0] => Array
                (
                    [0] => 7
                    [1] => 8
                    [2] => 9
                )

            [1] => Array
                (
                    [0] => 10
                    [1] => 11
                    [2] => 12
                )

        )

    [5] => Array
        (
            [0] => Array
                (
                    [0] => 7
                    [1] => 8
                    [2] => 9
                )

            [1] => Array
                (
                    [0] => 10
                    [1] => 11
                    [2] => 12
                )

            [2] => Array
                (
                    [0] => 13
                    [1] => 14
                    [2] => 15
                )

        )

)
```

可以看到,`array_unique_multi()`函数成功地去除了所有重复的子数组。

Converted HTML:

<p>&lt;&lt;&lt;标题:php二维数组去重函数:标题&gt;&gt;&gt;</p>
<p>以下是一个基于PHP的二维数组去重函数:</p>
<pre class="codehilite"><code class="language-php">function array_unique_multi($array){
    $result = array_map(&quot;unserialize&quot;, array_unique(array_map(&quot;serialize&quot;, $array)));
    foreach ($result as $key =&gt; $value){
        if ( is_array($value) ){
            $result[$key] = array_unique_multi($value);
        }
    }
    return $result;
}
</code></pre>

<p>这个函数首先使用<code>serialize()</code>和<code>unserialize()</code>函数将二维数组中的每个子数组序列化和反序列化,以便于进行数组去重。然后调用<code>array_unique()</code>函数对序列化后的数组进行去重,并使用<code>array_map()</code>函数将去重后的序列化数组映射回原数组。最后再使用递归的方式对子数组进行去重,直到所有子数组都没有重复元素。</p>
<p>使用该函数示例:</p>
<pre class="codehilite"><code class="language-php">$array = array(
    array(1, 2, 3),
    array(1, 2, 3),
    array(4, 5, 6),
    array(4, 5, 6),
    array(
        array(7, 8, 9),
        array(10, 11, 12),
        array(7, 8, 9)
    ),
    array(
        array(7, 8, 9),
        array(10, 11, 12),
        array(13, 14, 15)
    )
);

$result = array_unique_multi($array);
print_r($result);
</code></pre>

<p>输出结果:</p>
<pre class="codehilite"><code>Array
(
    [0] =&gt; Array
        (
            [0] =&gt; 1
            [1] =&gt; 2
            [2] =&gt; 3
        )

    [2] =&gt; Array
        (
            [0] =&gt; 4
            [1] =&gt; 5
            [2] =&gt; 6
        )

    [4] =&gt; Array
        (
            [0] =&gt; Array
                (
                    [0] =&gt; 7
                    [1] =&gt; 8
                    [2] =&gt; 9
                )

            [1] =&gt; Array
                (
                    [0] =&gt; 10
                    [1] =&gt; 11
                    [2] =&gt; 12
                )

        )

    [5] =&gt; Array
        (
            [0] =&gt; Array
                (
                    [0] =&gt; 7
                    [1] =&gt; 8
                    [2] =&gt; 9
                )

            [1] =&gt; Array
                (
                    [0] =&gt; 10
                    [1] =&gt; 11
                    [2] =&gt; 12
                )

            [2] =&gt; Array
                (
                    [0] =&gt; 13
                    [1] =&gt; 14
                    [2] =&gt; 15
                )

        )

)
</code></pre>

<p>可以看到,<code>array_unique_multi()</code>函数成功地去除了所有重复的子数组。</p>

This is ideal for more complex Markdown conversions – though it can also handle simple Markdown conversions!

ad1a1b7183122303

Download address
☁️
Download #1
Baidu Skydisk
Download now
微信赞赏

WeChat

支付宝赞赏

Alipay

✍️ Author: Hong Mu

webmaster · Thanks for reading, stay tuned for more exciting content

Author homepage View home page →

Related articles

Practical Tool: Nginx Website Log Analysis

Practical Tool: Nginx Website Log Analysis Practical Collection Utility tools

As the name suggests, this is a simple log analysis tool that can extract specific information from your website's logs! Step 1: Place the log file and the tool in the same directory. Place the Log file (Nginx website logs) into the program's directory, or copy/move the program to the directory where the log file is located. Step 2: Modify the log file name. Change the website log file name to `rizhi.log`; otherwise, the program will fail to operate...
👁 183
ChatGPT generates articles in Markdown format.

ChatGPT generates articles in Markdown format. Practical Collection Utility tools

In the early hours of March 2, OpenAI launched the official ChatGPT API – not the underlying GPT-3.5 large-scale model, but the core ChatGPT model itself: ChatGPT-3.5-Turbo! The ChatGPT-3.5-Turbo model is the model used by ChatGPT and represents the fastest, most cost-effective, and most flexible model in the GPT-3.5 series. It can deliver ultra-high...
👁 223
MSVBCRT.AIO.2019.10.19.X86/X64 (Microsoft Common Runtime Library Collection)

MSVBCRT.AIO.2019.10.19.X86/X64 (Microsoft Common Runtime Library Collection) Practical Collection Utility tools

Software for resolving DLL-related computer software errors: On Windows systems where official drivers (e.g., Microsoft Visual Studio 2015) are not fully installed, installing certain software may trigger an error message stating that a specific DLL file is missing and prevents the software from launching. This software package can resolve this issue; it is compatible with Windows 7, 8, 8.1, 10, and 11 operating systems.
👁 467
A simple yet powerful HTML code snippet – iFearMe Framework

A simple yet powerful HTML code snippet – iFearMe Framework Summary of pitfalls Practical Collection Utility tools

Since I prefer automation when building websites, many tasks require multiple visits to a single URL to process content stored on the server. In such cases, for various reasons, it may not be possible to simply refresh the page directly; this is where the iFearMe framework comes in handy! The iFearMe framework code: <!DOCTYPE html> <html> <head> <title...
👁 212
Online LRC to STR converter/Base64 decoding tool – implemented using HTML and jQuery

Online LRC to STR converter/Base64 decoding tool – implemented using HTML and jQuery Summary of pitfalls Practical Collection Website source code Utility tools

A very useful web application designed primarily to convert LRC lyric files to STR subtitle format, along with a Base64 decoding tool. Main Features: 1. LRC to STR Converter – Input: Users can paste LRC lyrics or upload an LRC file; Conversion: Click the "Convert to STR" button to convert the LRC file to STR format; Output: The converted STR subtitles are displayed; these can be downloaded or saved. 2. Base64 Decoding Tool...
👁 215

Recommended reading

Responsive Architectural Decoration Materials Technology Website Template 0890

Responsive Architectural Decoration Materials Technology Website Template 0890 Practical Collection Yiyou template

This EyouCMS responsive template is ideal for the construction, interior decoration, building materials, and technology industries. Its modern and professional design style makes it perfect for showcasing construction projects, interior decoration cases, building material products, and technological applications. It helps construction and technology enterprises effectively demonstrate their brand strength online. Template Display | Installation Instructions | Website Backend: /login.php | Username: admin | Password: admin | Related Articles: Summary of Common Installation Issues for EyouCMS | EyouCMS (...
👁 59
Simple Financial and Tax Accounting Promotion Page Website Template 0093

Simple Financial and Tax Accounting Promotion Page Website Template 0093 Practical Collection Yiyou template

This EyouCMS template is designed as a simple promotional page for financial and tax accounting services. It features a strong marketing-oriented design, a compact and efficient layout, and effectively highlights the advantages of financial and tax services, pricing policies, and contact information. It serves as an excellent tool for financial and tax firms conducting Baidu PPC or landing page marketing campaigns. Template Display | Installation Instructions | Website Backend: /login.php | Username: admin | Password: admin | Related Articles: Summary of Common Installation Issues for EyouCMS | EyouCMS...
👁 64
(Adaptive mobile version) PBootCMS template for business registration websites; Download source code for financial accounting agency websites – 0496

(Adaptive mobile version) PBootCMS template for business registration websites; Download source code for financial accounting agency websites – 0496 Practical Collection pbootcms Template

A PbootCMS website template designed for business registration and financial bookkeeping services, compatible with both PC and WAP devices. Its clean and professional design makes it ideal for financial and tax service providers to showcase their one-stop services—including bookkeeping, tax filing, and business registration. This template helps financial service agencies build a strong online brand presence and attract corporate clients. Template Overview | Installation Instructions | Website Backend: /admin.php | Username: admin | Password: admin | Extraction Password: www.4...
👁 43
Marketing-oriented cooking fume air purifier – Commercial induction cooker appliance website template 0891

Marketing-oriented cooking fume air purifier – Commercial induction cooker appliance website template 0891 Practical Collection Yiyou template

An eYouCMS website template designed for the marketing-oriented range of kitchen fume air purifiers and commercial induction cooktops industry. Its modern, tech-driven design is ideal for showcasing air purification products, commercial induction cooktops, technical solutions, and brand strength. This template helps kitchen appliance manufacturers showcase their products online and attract commercial clients. Template Overview | Installation Instructions | Website Backend: /login.php | Username: admin | Password: admin | Related Articles: EasyYouCMS Installation Guide...
👁 62
Responsive Geological Survey Fieldwork Unit Website Template 0095

Responsive Geological Survey Fieldwork Unit Website Template 0095 Practical Collection Yiyou template

An eYouCMS responsive website template designed for geological survey institutes and similar organizations. Its professional and sophisticated design effectively showcases survey results, technical expertise, project cases, and institutional functions. This template helps survey and design institutes establish an authoritative online presence and attract both government and corporate clients. Template Display | Installation Instructions | Website Backend: /login.php | Username: admin | Password: admin | Related Articles: Common Questions About eYouCMS Installation...
👁 39