Hongmu Notes
Home Language Notes PHP

PHP

PHP (Hypertext Preprocessor) is a server-side scripting language particularly suited for web development and can be embedded within HTML. Its syntax is derived from the C language, incorporating features from languages such as Java and Perl to develop its own distinctive grammar; it has also been continuously refined and enhanced based on the strengths of these languages—for example, leveraging Java's object-oriented programming capabilities.

php jump to specified page

php jump to specified page Language Notes PHP

● PHP page jump 1. header () function header () function is a very simple method for page jump in PHP. The main function of the header () function is to output the HTTP protocol header to the browser. The definition of the header () function is as follows: VoidHeader (String String [,Boolrep …
👁 209
PHP ob function record

PHP ob function record Language Notes PHP

Usage of the following three functions ob_get_contents(); ob_end_clean(); ob_start(); You can use these functions to buffer local files and execute local script code. Use ob_start() to save the output code into the buffer, and the page will not be displayed; then use ob_get_contents to get the data in the buffer. o…
👁 141
Multiple methods for specifying whether a string is included in a php string

Multiple methods for specifying whether a string is included in a php string Language Notes PHP

The `str strstr()` function searches for the first occurrence of one string within another string. It returns the remaining part of the string (starting from the matching position); if the target string is not found, it returns `false`. The code is as follows: `<?php $email = 'user@example.com'; $domain = strstr($email,...`
👁 138
php obtains the web page source code (accesses and returns the web page source code)

php obtains the web page source code (accesses and returns the web page source code) Language Notes PHP

Below are several commonly used methods in PHP for scraping content from web pages: 1. `file_get_contents` – PHP code: The code is as follows: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > &gt
👁 218
Typecho index.php homepage template production common codes

Typecho index.php homepage template production common codes Language Notes PHP

Creating templates is not difficult at all; once you've written your HTML and CSS code, nesting templates becomes straightforward. You don't need to understand the internal structure of the tags—simply know how to use them, and you can quickly complete your templates. This article provides a brief introduction to how to use common tags, with the aim of helping you explore the world of templating. Let's start with the main file: when you open this file, the first thing you'll see is a comment: /** * This is a set of default settings for the Typecho system...
👁 269
PHP capture website source code and json parsing

PHP capture website source code and json parsing Language Notes PHP PHP collection

Recently, I wanted to collect the names of some resource websites, so I found a fun one when I collected it. The opposite website was loaded by ajax technology, so I found the api, so I just wrote the code directly to put it in the warehouse. The code is backed up here and will be used in the future. & lt; ? php $date = file_get_contents(' Website address ' ); $date = json_deco…
👁 136
PHP preg

PHP preg Language Notes PHP

The preg_match_all function is used to perform a global regular expression match. preg_match_all() Syntax int preg_match_all ( string $pattern , string $subject [, array &$matches [, int $flags = PREG…
👁 169
Detailed explanation of PHP ternary operator and if

Detailed explanation of PHP ternary operator and if Language Notes PHP

Ternary operator condition ? Result 1 : Result 2 Explanation: The position in front of the question mark is the condition for judgment. If the condition is met, the result is 1, and if it is not met, the result is 2. This article compares and explains the ternary operator and if...else... in detail. I hope it will be helpful to everyone. Today when I was revising my paper online, I encountered a statement that I couldn’t understand: $if_summary = $row['IF_SUMMARY']=…
👁 189
PHP cast type

PHP cast type Language Notes PHP PHP collection PHP and mysql

Get the data type 1. If you want to check the value and type of an expression, use var_dump(). 2. If you just want to get an easy-to-read type expression for debugging, use gettype(). 3. To check a certain type, do not use gettype(), but use the is_type() function. Converting Strings to Numbers When a string is evaluated as a number, the result is determined according to the following rules...
👁 232
1 20 21 22