In PHP, the name of the current script (excluding the path and query string) is recorded in the predefined variable (1), and the URL linked to the current page is recorded in the predefined variable (2).
Echo $ _ SERVER ['php _ SELF ']; echo $ _
Currently, HTTP servers support PHP in three ways:
Implemented through the built-in modules of HTTP Server, such as Apache mod_php5. Similar to Apache's built-in mod_perl, perl can be supported;
Through CGI, this is like the previous perl CGI.
To better demonstrate the way MVC works, we use a simple news article publishing system as an example. There are two methods: MVC and MVC. We will only give a basic demonstration, read some article lists from the database, and display them on the
CGI
CGI is a Common Gateway Interface. It is a tool for the HTTP server to "talk" with programs on your or other machines, the program must run on the network server.
CGI can be written in any language as long as it has standard input, output, and
Requirement: capture part of the content of a page, and then iframe to another page. When iframe is used, you do not need to access the source page every time. Instead, you only read the Source Page once a day and generate a file. When iframe is
Modify the session expiration time in php to modify the session. gc_maxlifetime in the php configuration file php. ini.
Each time php sends a request, it has a 1/100 probability (default) to trigger "session reclaim ". If "session Recycle" occurs,
Destructor: it is executed when an object becomes junk or when the object is explicitly destroyed.GC (Garbage Collector)
In PHP, when no variable points to this object, this object becomes garbage. PHP will destroy it in the memory.
This is the
Recently, I feel that the database pressure on my website is quite high, which causes the website to speed down very quickly. Because a considerable number of pages are directly connected to the database to read data, this part of pages is also
What is the Zend Framework MVC design pattern?
The Model-View-Controller (MVC) mode refers to the Model-attempt-Controller mode. Its core idea is to divide the entire program code into three components that are relatively independent and can work
The front-end controller is the painstaking effort in the Construction of MVC, because it has to instantiate objects, trigger events, establish default behaviors, and so on. Its main purpose is to process all requests entering the application. The
During the PHP website development process, you may encounter many escape points. Below we recommend several good functions to improve the standardization of website input and output.
1. plain text output, suitable for input
function t($text){$text =
Fopen () method
The simplest method is to use fopen () to check whether the file can be opened. If the file can be opened, the file exists.
The fopen () function opens a file or URL. If it fails to be opened, the function returns FALSE.
Syntax:
Array traversal is a common programming task in PHP. arrays are classified into one-dimensional arrays, two-dimensional arrays, and multi-dimensional arrays. The traversal of one-dimensional arrays is simple, and a for loop can be completed directly.
PHP: after each HTTP request comes over, all resources are initialized (for example, database links are created, system class libraries are loaded, and cache is created), processed, and all resources are released.
Python/Ruby: resources are
When we need to split an array into arrays based on a character or string, the explode () function is very useful, but do you know how explode () works? If you intercept strings, you will not be able to avoid the consumption of Space reallocation.
When CI is not used, we can use error_reporting (E_ALL); error_reporting (0); such code to control the error reporting level. Of course, you can also use these statements in the class, but CI itself has a mechanism to control the error level.
You
In some cases, we need to process some html text. For example, we need to remove the hyperlink content from the text, so we need to use regular expressions. For example, you can use $ str = preg_replace ("/] * href = [^>] *> | ] *>/I ", "", $
I sorted out a written question from a PHP senior engineer, with comprehensive questions. Well, basically all these questions are well answered, so you should be competent for the PHP job of most Internet companies. The following is a question.1.
Introduction to cookies and sessions
In many cases, we need to track the activities of visitors on the entire website and automatically or semi-automatically identify their identities (that is, the usual website login and other functions). At this
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service