PHP _ PHP Tutorial

Source: Internet
Author: User
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...

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.