search
HomePHP LibrariesOther librariesContent Negotiation PHP Library
Content Negotiation PHP Library
<?php
if (! ($loader = @include __DIR__ . '/../vendor/autoload.php')) {
    die(<<<EOT
You need to install the project dependencies using Composer:
$ wget http://getcomposer.org/composer.phar
OR
$ curl -s https://getcomposer.org/installer | php
$ php composer.phar install --dev
$ phpunit
EOT
    );
}
$loader->add('Negotiation\Tests', __DIR__);

Content negotiation technology usually has three implementation schemes:

(1) Client driver

The client initiates a request, the server sends a list of options, and after the client makes a selection, it sends the Second request.

Advantages: relatively easy to implement

Disadvantages: increased delay, at least two requests must be sent, the first request to obtain the resource list, and the second request to obtain the selected copy.

(2) Server driver

The server checks the client's request header set and decides which version of the page to provide.

Advantages: Faster than client-driven negotiation. HTTP provides a q mechanism that allows the server to approximate matching, and also provides a vary header for the server to tell downstream devices (such as proxy servers) how to evaluate the request.

Disadvantages: The header set does not match, the server has to make guesses

(3) Transparent negotiation

An intermediate device (usually a cache proxy) negotiates on behalf of the client

Advantages: Eliminates the negotiation overhead of the web server and is faster than client-driven negotiation.

Disadvantages: HTTP does not provide corresponding specifications


Disclaimer

All resources on this site are contributed by netizens or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this site are for learning reference only. Please do not use them for commercial purposes. Otherwise, you will be responsible for all consequences! If there is any infringement, please contact us to delete it. Contact information: admin@php.cn

Related Article

Memcache vs. Memcached: Which PHP Library Should You Choose?Memcache vs. Memcached: Which PHP Library Should You Choose?

09Nov2024

Distinguishing "Memcache" and "Memcached" in PHPPHP offers two memcached libraries: memcache and memcached. Understanding their differences helps...

How Do I Link Static Libraries That Depend on Other Static Libraries?How Do I Link Static Libraries That Depend on Other Static Libraries?

13Dec2024

Linking Static Libraries to Other Static Libraries: A Comprehensive ApproachStatic libraries provide a convenient mechanism to package reusable...

Memcache vs Memcached: Which PHP Memcached Library Should You Choose?Memcache vs Memcached: Which PHP Memcached Library Should You Choose?

19Nov2024

Memcache vs Memcached: Choosing the Right PHP Memcached LibraryIntroductionPHP offers two seemingly similar memcached libraries: memcache and...

Which PHP Library Best Fits Your Email Address Validation Needs?Which PHP Library Best Fits Your Email Address Validation Needs?

18Nov2024

PHP Email Address Validation Libraries UncoveredEmail address validation plays a crucial role in data validation, but creating a...

laravel - What should the standardized PHP class library naming look like?laravel - What should the standardized PHP class library naming look like?

06Jul2016

I have seen many open source projects in the form of class.classname.php, but I have also seen many frameworks in the form of classname.class.php. Where should I place this class? I personally prefer the .class.php form, because in some frameworks, after importing third-party class libraries and specifying class libraries...

Memcache vs. Memcached: Which PHP Caching Library Should You Choose?Memcache vs. Memcached: Which PHP Caching Library Should You Choose?

12Nov2024

Memcache vs. Memcached: Choosing the Right PHP Library for Your Cache NeedsIn the realm of PHP caching libraries, Memcache and Memcached stand out...

See all articles