Category:PHP

  • Detailed explanation of PHP sprintf() formatting usage

    Time:2021-8-2

    PHP sprintf function is a very powerful function. This article specifically records the usage of the sprintf function in PHP to format strings. Definition and Usage The sprintf () function writes the formatted string to a variable. grammarsprintf(format,arg1,arg2,arg++) Parameter descriptionFormat is required. Convert format.Arg1 is required. Specifies the parameter inserted at the first% symbol in […]

  • Mysqli in PHP_ get_ server_ Instance usage of version()

    Time:2021-8-2

    This article introduces mysqli in PHP_ get_ server_ The definition and usage of the version () method. I hope it will be helpful to the little partners who are learning MySQL and PHP! Definition and Usage mysqli_ get_ server_ The version() function returns the MySQL server version as an integer. The MySQL server version will […]

  • Composer update commands and common commands

    Time:2021-8-1

    Original address:https://www.wjcms.net/archives/composer Update commands and common commands Composer is a package dependency management tool for PHP. Developers upload the developed toolkit and users can use it easily. Let’s summarize it today. Composer installation Official address:https://getcomposer.org/download/Download address:https://getcomposer.org/Composer-Setup.exeDownload and install directly. Check that the installation is complete Use command: composer –version #Be careful to capitalize here composer […]

  • PHP post line feed method

    Time:2021-8-1

    How does PHP post line feed? How to wrap the value taken out of PHP in the text! The problem code is as follows: <?php $str=$_POST[‘name1′].’-‘.$_POST[‘phone1′].’-‘.$_POST[‘address’].’-‘.$_POST[‘express’]; echo $str.”<br>”; $fp=fopen(“b.txt”,”a+”); fwrite($fp,$str);// write in fclose($fp);// close ?> terms of settlement: $str=$_POST[‘name1′].’-‘.$_POST[‘phone1′].’-‘.$_POST[‘address’].’-‘.$_POST[‘express’].”\r\n”; Just add “\ R \ n” after it, this is the newline character of the text. […]

  • Source code analysis of hyperf / cronab component

    Time:2021-7-31

    Pre reading:Hyperf / cronab documentation Pre reading:Hyperf / process custom process usage documents Pre reading:Hyperf event mechanism Write at the beginning Used in previous projectsHyperf/CrontabComponent for second level data cleaning. Recently, I’m splitting scheduled tasks. So I’m going to go through the component source code to deepen my understanding. By the way, I think about […]

  • Yii2 rules custom rules

    Time:2021-7-31

      Yii2 provides a complete set of parameter verification rules, but sometimes it may not meet the actual needs. We need to customize the rules. Here is a brief introduction to the use of custom rules. For example, there is a parameter country, which can only receive ‘USA’ and ‘Web’, and the rest of the […]

  • PHP implementation of New Coronavirus epidemic real-time map

    Time:2021-7-31

    Let’s take a look at the operation diagram first Let’s look at the source code: <?php // interface data for grasping tremble tiktok global $nCov_data; $nCov_data[‘data’]=get_nCoV_douyin_news(); $nCov_data[‘total’]=get_nCoV_douyin_total(); function get_nCoV_douyin_news(){ [email protected]_get_contents(‘https://i.snssdk.com/api/feed/forum_flow/v1/?forum_id=1656388947394568&is_web_refresh=1&channel=local_test&query_id=1656388947394568&tab_id=1656388947394584&is_preview=1&stream_api_version=82&aid=13&forum_id=1656388947394568&is_preview=0’); $c=count(json_decode($content)->data)-1; [email protected]_decode(json_decode($content)->data[$c]->content)->sub_raw_datas; if ($getInfos){ foreach ($getInfos as $k=>$Info){ $data[$k]=[ ‘showtime’=>$Info->raw_ data->showtime_ String, // display time ‘desc’=>$Info->raw_ Data – > DESC, // SMS ‘event_ time’=>$Info->raw_ data->event_ […]

  • PHP elasticsearch to explain search examples

    Time:2021-7-30

    Elasticsearch is a Lucene based search server. It provides a distributed multi-user full-text search engine based on restful web interface. Elasticsearch is developed in Java and released as an open source under the Apache license terms. It is a popular enterprise search engine. Designed for cloud computing, it can achieve real-time search, stable, reliable, fast, […]

  • Encapsulate curl_ Multi allows requests to be executed in parallel with business logic

    Time:2021-7-30

    Other requests are required in PHP developmentHTTP (s) service interfaceMany people will directly use the built-incurlTools. amongcurl_multiYou can combine the previous individualCurl requestIt is added to a batch to execute in parallel, which is implemented in terms of time overheadMax (interface 1, interface 2, interface 3…)It can reduce the sense of waiting for users when […]

  • ThinkPHP uses Ajax program to report 500 errors

    Time:2021-7-30

    App_ After debug is enabled, you can see the error prompt in the preview in the developer tool network, and adjust it according to the error  

  • Fiddler grabs Baidu app Live Room comments PHP

    Time:2021-7-29

    This article focuses on capturing Baidu app Live Room comments, automatically saving local files, and extracting and parsing them in PHP. Pre preparation Fiddler configuration, OpenSSL installation, etc. there are more online materials, which is not a problem. Android emulators (such as nocturnal). Garbled code problem Check decode on the toolbar Writing custom rules findOnBeforeResponsemethod […]

  • Three ways of PHP recursion

    Time:2021-7-29

      1、 Using references as parameters PHP references allow two variables to point to the same content, such as $a = & $B; That means  $ a   and  $ b   Points to the same variable. In the following example, because $data uses reference passing, the data will always accumulate. function recursion(&$data = [], […]