+
Skip to content
This repository was archived by the owner on Nov 7, 2018. It is now read-only.

krmgns/headers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Usage

  • Setting & sending headers
// so
$h = new Headers();
$h->setCacheControl('public, max-age=10');
$h->send();

// or
$h = new Headers(array(
    'Cache-Control' => 'public, max-age=10',
    // ...
));
$h->send();

// or
$h = new Headers();
$h->set('Cache-Control', 'public, max-age=10');
$h->send();

$h = new Headers();
$h->set(array(
    'Cache-Control' => 'public, max-age=10',
    'Pragma' => 'no-cache',
    // ...
));
$h->send();
  • Getting headers
// all valid
print $h->getCacheControl();
print $h->get('Cache-Control');
print $h->get('cache-control');
  • Removing headers
// remove one
$h->remove('Cache-Control');
$h->remove('cache-control');
// remove all
$h->removeAll();

Note: Header object can play with self-own headers only

header('Content-Type: text/plain');
// ...

// these won't work for 'Content-Type' if not presented in object
$h->remove('Content-Type');
$h->removeAll();

About

Play with headers easily.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载