PHP_EOL uses the ApacheMina framework. PHP_EOL practices using the ApacheMina framework 1. why should we use the ApacheMina framework? ApacheMinaServer is a network communication application framework. Mina can help us quickly develop high-performance and high-scalability PHP_EOL practices using the Apache Mina framework
1. Why use the Apache Mina framework?
ApacheMina Server is a network communication application framework. Mina can help us quickly develop high-performance and highly scalable network communication applications, mina provides a programming model for event-driven and asynchronous (asynchronous IO of Mina uses JAVANIO as the underlying support by default) operations.
2. use ApacheMina framework
Mina execution process:
> IoService: this interface is used to establish a socket on a thread and has its own Selector to monitor whether a connection is established.
> IoProcessor: this interface is used on another thread to check whether data is read and written through the Channel. In other words, it also has its own Selector, this is different from java nio encoding. in java nio encoding, we usually use a Selector, that is, we do not distinguish between IoService and IoProcessor. In addition, IoProcessor is responsible for calling the filter registered on IoService and calling IoHandler after the filter chain.
> IoFilter: this interface defines a set of interceptors, which can include log output, blacklist filtering, data encoding (write direction), and decoding (read direction, the encode and decode of the data are the most important, and the most important thing you pay attention to when using Mina.
> IoHandler: this interface is used to compile the business logic, that is, to receive and send data.
Line break
\ N for unix
Windows \ r \ n
Mac \ r
PHP can be replaced with PHP_EOL to improve the source code portability.
For example:
Echo PHP_EOL;
// The windows platform is equivalent to echo "\ r \ n ";
// The unix/linux platform is equivalent to echo "\ n ";
// The mac platform is equivalent to echo "\ r ";
?>
Similar to common
DIRECTORY_SEPARATOR
You can use the get_defined_constants () function to obtain all PHP constants.
Using Apache Mina framework Practice 1. why should we use Apache Mina framework ApacheMina Server as a network communication application framework? Mina can help us quickly develop high performance and high scalability...