Category:PHP

  • On the problem that the code can not take effect in time after modification

    Time:2020-11-25

    Today, after the modified code is uploaded to the server via FTP, even if the cache is deleted, it still doesn’t take effect, with a delay of about 10 seconds. After research, it is found that the reason is that PHP starts the opcache extension, and the deletion of this extension takes effect immediately. It […]

  • PHP design pattern code examples of null object (25)

    Time:2020-11-25

    objective The empty object pattern is not a GOF design pattern, but it is enough to be considered a design pattern as a frequent pattern. It has the following advantages: The client code is simple It can reduce the probability of null pointer exception Test cases don’t need to consider too many conditions Return an […]

  • How PHP gets HTTP requests

    Time:2020-11-25

    Method of getting HTTP request by PHP $5 Introduction to server $5 Server is an array of information such as header, path, and script locations. Sample method for getting HTTP request $req_method = $_SERVER[‘REQUEST_METHOD’]; echo $req_method; Examples supplement: Socket mode Using socket to establish connection, splicing HTTP message to send data for HTTP request. An […]

  • PHP Xdebug configuration

    Time:2020-11-24

    Introduction to Xdebug Xdebug is an open source PHP debugger, which can be used to track, debug and analyze the running status of PHP. It is powerful and helpful to audit The. Xdext / PHP file is usually installed in a PHP directory_ xdebug.dll 。 By configuring the php.ini Document usage After configuring Xdebug, a […]

  • Strategy of PHP design pattern

    Time:2020-11-24

    This paper describes the strategy pattern strategy of PHP design pattern. For your reference, the details are as follows: 1. Overview In software development, there are many algorithms to realize a certain functionStrategy, we can choose different algorithms or strategies according to different environment or conditions to complete the function。 For example, hard coding is […]

  • Comparison of floating point numbers

    Time:2020-11-23

    Floating point size comparison var_dump(2.7 == 2.7); //bool(true) var_dump(8.1/3); //2.7 #Because of the accuracy, this comparison is not equal to var_dump(8.1/3 == 2.7); //bool(false) #This comparison is equal var_dump(round(8.1/3) == round(2.7)); //bool(true) Note: when the result of the integer operation is beyond the range of floating-point numberThe maximum integer value is: PHP_ INT_ MAX This […]

  • Observer code examples of PHP design patterns (27)

    Time:2020-11-23

    objective When the state of an object changes, all objects that depend on it are notified and automatically updated. It uses a low coupling approach. example If the content is good, I hope you can support and encourage you to click like / like, and you are welcome to exchange views. In addition, if you […]

  • Introduction to PHP design patterns [concept, classification, principles, etc.]

    Time:2020-11-23

    This article describes the PHP design pattern. For your reference, the details are as follows: 1. Design pattern Design pattern is a set of repeated use, most people know, after classification cataloging, code design experience summary. Design patterns are used to reuse code, make it easier for others to understand, and ensure code reliability. No […]

  • PHP 14 week function learning record

    Time:2020-11-22

    filter_has_var() effect filter_has_var()Function to check the existence of a variable of the specified input type. usage filter_has_var(type, variable) type INPUT_GET INPUT_POST INPUT_COOKIE INPUT_SERVER INPUT_ENV case <?php if(!filter_has_var(INPUT_GET, “name”)) { echo(“Input type does not exist”); } else { echo(“Input type exists”); } ?> result Input type exists filter_id() effect filter_id()Function returns theIDnumber. usage filter_id(filter_name) case <?php […]

  • Specification code examples of PHP design patterns (28)

    Time:2020-11-22

    objective Build a clear business rule specification, in which each rule can be targeted. Each specification class has a method called issatisfiedby, which determines whether a given rule meets the specification and returns true or false. RulerZ UML diagram The official PHP advanced learning exchange community “click” manages and sorts out some materials. Bat and […]

  • PHP design pattern (1) factory mode

    Time:2020-11-22

    This paper describes the PHP design pattern (1) factory mode. For your reference, the details are as follows: In object-oriented programming, the most common method is to generate an object instance by a new operator. The new operator is used to construct the object instance. However, in some cases, the new operator directly generates objects, […]

  • ThinkPHP 6.0 foundation tutorial – Installation

    Time:2020-11-21

    Series articles: ThinkPHP 6.0 foundation tutorial – Installation ThinkPHP 6.0 basic tutorial – basic process ThinkPHP 6.0 basic tutorial – add, delete, modify and check ThinkPHP6.0Environment: PHP >= 7.1.0 My local environment: Win10 PhpStudy installPhpStudy If you have already installedPhpStudyOr other environment, please ignore here The installation method is very simple, and it can be […]