Hongmu Notes
Home Language Notes

Language Notes

Here's a very practical article featuring pseudo-original PHP code.

Here's a very practical article featuring pseudo-original PHP code. Language Notes PHP

This code can randomly insert ASCII characters into an article, while the frontend can hide these ASCII characters – thereby ensuring that the user experience remains unaffected while simultaneously misleading Baidu's web crawler, achieving a pseudo-original content effect. This code was extracted from several novel websites and is highly practical! PHP code: function randAscii($string) {if (empty...
👁 334
Convert text-based lyrics into HTML-format lyrics.

Convert text-based lyrics into HTML-format lyrics. Language Notes PHP

Lyrics to be converted: [01:04.81] Hello [02:57.54][00:42.86] True affection is as vast as the grasslands [03:04.81][00:50.07] Layers of wind and rain cannot separate us [05:04.81] Conversion result: <p data-time="01:04.81">Hello</p> <p da...
👁 163
Web page playing music scrolling lyrics effect

Web page playing music scrolling lyrics effect Language Notes JavaScript

When the web page plays audio, you can use jQuery and HTML to achieve the scrolling effect of lyrics. The following is a simple implementation: HTML: &lt;div id="lyrics"&gt; &lt;p data-time="0:00.00"&gt;Written by : doll&lt;/p&gt; &lt;p data-time="0:01.00"…
👁 189
Why does this code produce an extra '1' when executed? <?=require('./common/aside.php')?>

Why does this code produce an extra '1' when executed? <?=require('./common/aside.php')?> Language Notes PHP

Why does this code produce an extra '1' when executed? <?= require('common/aside.php');?> In PHP, the `require` and `include` statements are used to include the content of other PHP files into the current file. These statements allow code to be reused across multiple files, thereby improving code reusability and maintainability. In the code snippet above...
👁 186
After PHP collects data, process the function of collecting the data

After PHP collects data, process the function of collecting the data Language Notes PHP

Function: function xxfseo_body($body){ $body = preg_replace('~<(?!img)(\w+)\s+[^>]*>~i','<$1>', $body); $body = preg_replace("/<(iframe.*?)…
👁 3365
Back up some PHP code from Yiyun.

Back up some PHP code from Yiyun. Language Notes PHP

I conducted some testing and scraped songs from Yiyun – approximately over 20,000 artists and 10 million songs in total. Naturally, I have deleted all this data; the primary purpose was to write and experiment with some code, so I've backed up the code here. Scraping songs based on artist ID: 🔒 Hidden content: Members can view <?php $shuju_file = "shuju.txt"; $shuju = @json_decode...
👁 146
After clicking to submit the form in Empire CMS, use js to combine the URL and redirect it

After clicking to submit the form in Empire CMS, use js to combine the URL and redirect it Program Notes Empire cms Language Notes JavaScript

Many times, the search link is too long and carries many parameters. We want to make pseudo-static modifications and also hope that the link can be accessed a second time. Original html code: 🔒 Hidden content: You can view it after logging in &lt;form class="form-search" id="q-form" method="get"&gt; &lt;div class="input-…
👁 303
PHP reads the content of a text file line by line, outputs 100 lines at a time, and supports paginated output.

PHP reads the content of a text file line by line, outputs 100 lines at a time, and supports paginated output. Language Notes PHP

You have a TXT file containing one million titles, with one title per line. Each time you access the file, you are passed a `pageid`; when `pageid` is 1, the first to 100 titles in the file are output; when `pageid` is 2, the 101st to 200th titles are output; and so on. The PHP code is also very simple: 🔒 Hidden content: Members can view <?php // Open the title file $ha...
👁 173
A PHP function that adds or subtracts a specified amount of time from a timestamp and returns the result in a specified format.

A PHP function that adds or subtracts a specified amount of time from a timestamp and returns the result in a specified format. Language Notes PHP PHP and mysql

Here is a PHP function that adds or subtracts a specified amount of time from a timestamp and then outputs the resulting time in a specified format: <?php /** * Adds or subtracts a specified amount of time from a timestamp and outputs the resulting time in a specified format * * @param string $time-Date-time string in the format 'Y-m-d H:i:s' * @param int $seconds-The amount of time to add...
👁 148
PHP connects to the database and determines whether the SQL statement is executed successfully

PHP connects to the database and determines whether the SQL statement is executed successfully Language Notes PHP

I must be getting increasingly lazy – just leave this code here, and you can simply copy it next time you need to use it! <?php // Set database connection parameters $servername = "localhost"; // Server name $username = "your_username"; // Username $password = "your_password"; // Password...
👁 108
1 5 6 7 8 9 33