• Analysis on the method of transforming SVG into PNG format with PHP


    This paper describes the method of transforming SVG into PNG format by PHP. Share with you for your reference, as follows: Implementation of SVG to png 1. PHP imagick extension a. Study the method of imagick plug-in $im = new Imagick($upload_path . $file_name); $svg = file_get_contents($upload_path . $file_name); $svg = ‘<?xml version=”1.0″ encoding=”UTF-8″ standalone=”no”?>’.$svg; $im->readImageBlob($svg); […]

  • PHP variable scope (global variable & local variable) & Global & static keyword usage example analysis


    This article describes the usage of PHP variable scope (Global & local variables) & Global & static keyword. Share with you for your reference, as follows: We know that variables are actually equivalent to the containers we use to store information. I believe you are quite clear about its naming rules, so I won’t repeat […]

  • Detailed explanation of message queue principle and implementation method of PHP advanced programming


    This paper describes the principle and implementation of message queue in PHP advanced programming. Share with you for your reference, as follows: 1. What is message queue Message queue (English: message queue) is a way of communication between processes or between different threads of the same process 2. Why use message queue Message queue technology […]

  • Complete example of shopping cart class implemented by PHP + PDO


    This article describes the shopping cart class implemented by PHP + PDO. Share with you for your reference, as follows: <?php session_start(); class Cart { public $pdo = null; public function __construct($config) { $host = $config[‘host’]; $user = $config[‘user’]; $db = $config[‘db’]; $pwd = $config[‘pwd’]; if (empty($_SESSION[‘user_id’])) { Return show (0, ‘please log in first’); […]

  • Detailed explanation of PHP regular email statement


    Copy codeThe code is as follows: <?php   if (eregi(“^[_.0-9a-z-][email protected]([0-9a-z][0-9a-z-]+.)+[a-z]{2,3}$”,$email)) {   echo   “Your   E-Mail   Pass the preliminary inspection “;   }   ?>    In this sentence, the first is to apply an eregi function, which is easy to understand. Just look for a book and you’ll get an explanation:  Syntax:   int   ereg(string   pattern,   […]

  • PHP uses bit operation to realize the code of four operations


    The most basic operating unit of a computer is a byte. A byte is composed of 8 bits. A bit can only store one 0 or 1. All data are stored and calculated in binary, i.e. 1 and 0. This time, we try to use bit operation to realize four operations in PHP. First, we […]

  • PHP development forum system


    1. Overall design Some things at the front end You can order everything. Click in the forum index.php <!doctype html> <html lang=”en”> <head> <meta charset=”UTF-8″> <meta name=”viewport” content=”width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0″> <meta http-equiv=”X-UA-Compatible” content=”ie=edge”> <title>Document</title> </head> <!– New bootstrap 4 core CSS file — > <link rel=”stylesheet” href=”bootstrap-4.4.1-dist/css/bootstrap.min.css” rel=”external nofollow” > <!– JQuery file. […]

  • Expanded use of PHP pthread and points for attention


    1、 Creation and use of threads 1. Thread class Basic creation and use: <?php //Implement your own thread class myThread by inheriting the thread class class MyThread extends Thread{ //Override constructor function __construct(){ } //Override the run method (running the tasks that the child thread needs to perform) function run(){ } } //Object instantiation and […]

  • PHP implementation of file fragment upload example code


    Super global variable array for PHP$_ Files to record the information related to file upload. 1.file_uploads=on/off Allow uploading files via HTTP 2.max_execution_time=30 The maximum execution time of the script is allowed. If it exceeds this time, an error will be reported 3.memory_limit=50M Set the maximum amount of memory that a script can allocate to prevent […]

  • PHP regular expression learning notes


    Copy codeThe code is as follows: //Match text, which is easy to use occasionally, but be careful that the characters contain \ E  $str = ‘[a-z]’;  $str = preg_replace(‘/\G[a-z]\E/’, ”, $str);  echo  $ str;  // Print empty, all replaced, probably preg_ Quote function  Copy contents to clipboard code:  //Name the matching result so that it can be used to get the […]

  • PHP gets the example code of this year, this month, this week timestamp and date format


    Timestamp format: //Get today’s start timestamp and end timestamp $beginToday=mktime(0,0,0,date(‘m’),date(‘d’),date(‘Y’)); $endToday=mktime(0,0,0,date(‘m’),date(‘d’)+1,date(‘Y’))-1; //Get yesterday’s start timestamp and end timestamp $beginYesterday=mktime(0,0,0,date(‘m’),date(‘d’)-1,date(‘Y’)); $endYesterday=mktime(0,0,0,date(‘m’),date(‘d’),date(‘Y’))-1; //Get the start timestamp and end timestamp of the week $beginThisweek = mktime(0,0,0,date(‘m’),date(‘d’)-date(‘w’)+1,date(‘y’)); $endThisweek=time(); //Get the start timestamp and end timestamp of the last week $beginLastweek=mktime(0,0,0,date(‘m’),date(‘d’)-date(‘w’)+1-7,date(‘Y’)); $endLastweek=mktime(23,59,59,date(‘m’),date(‘d’)-date(‘w’)+7-7,date(‘Y’)); //Get the start timestamp and end timestamp of […]