Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6125805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:17:25+00:00 2026-05-23T16:17:25+00:00

I want to make something like this: if (isset($_SERVER[‘HTTP_IF_MODIFIED_SINCE’])) { header(‘HTTP/1.1 304 Not Modified’);

  • 0

I want to make something like this:

if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
    header('HTTP/1.1 304 Not Modified');
    exit;
}

...... other code .....

typing to do it this way:

public function imageAction()
{
    $request = $this->getRequest();
    $response = $this->getResponse();
    if ($request->getHeader('IF_MODIFIED_SINCE')) {
        $response->setHttpResponseCode(304);
        return;
    }
    var_dump($request->getHeaders());
    $response->setHeader('Last-Modified', gmdate('D, d M Y H:i:s', time()).' GMT');
    var_dump($response->getHeaders());
    echo '11111';
    exit;

Hope result readers must be like

> this: Date: Thu, 07 Jul 2011 09:28:08
> GMT Server: Apache/2.2.15 (Linux/SUSE)
> X-Powered-By: PHP/5.3.7RC2-dev
> Last-Modified: Thu, 07 Jul 2011
> 09:27:48 GMT Content-Length: 7101
> Content-Type: text/html
> 
> 200 OK

but it is always :

> Date: Thu, 07 Jul 2011 09:30:16 GMT
> Server: Apache/2.2.15 (Linux/SUSE)
> X-Powered-By: PHP/5.3.7RC2-dev
> Expires: Thu, 19 Nov 1981 08:52:00 GMT
> Cache-Control: no-store, no-cache,
> must-revalidate, post-check=0,
> pre-check=0 Pragma: no-cache
> Content-Length: 347 Keep-Alive:
> timeout=15, max=99 Connection:
> Keep-Alive Content-Type: text/html
> 
> 200 OK

or I must use zend_cache?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T16:17:25+00:00Added an answer on May 23, 2026 at 4:17 pm

    It seems to be working fine. Try these two actions to test. You’ll need to set your domain name in place of ‘yourdomain‘ below.

    public function headerAction()
    {
        $response = $this->getResponse();
        $request = $this->getRequest();
    
        if ($request->getHeader('IF-MODIFIED-SINCE')) {
            $response->setHttpResponseCode(304);           
    
            return;
        }
    
        $response->setHeader('Pragma', 'public', true);
        $response->setHeader('Cache-control', 'max-age=' . 60*60*24*14, true);
        $response->setHeader('Last_Modified', gmdate('D, d M Y H:i:s', time()).' GMT', true);
    
        // don't exit or die here or Zend Framework won't send our $response or headers
        // If you don't want to render a script, uncomment the two lines below
        //        $this->_helper->viewRenderer->setNoRender();
        //        $this->_helper->layout->disableLayout();
    
    }
    
    public function clientAction()
    {
        $client = new Zend_Http_Client('http://yourdomain/test/header');
        $client->setHeaders('If-Modified-Since', 'Sat, 29 Oct 1994 19:43:31 GMT');
        $response = $client->request();
    
        Zend_Debug::dump($response->getStatus()); //prints 304
        Zend_Debug::dump($response->getHeaders());
    
        exit;    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to make something like this... :LoopBegin if ???? goto End some other
I want to make a route something like this: routes.MapRoute( Default, // Route name
I want make a simple referral system. Basically referral URL structure something like this.
I have to make something like an accordion, but I want it to fade
say I want to make the first row of the excel ss something like
I want to make this kind of query: create procedure something @name varchar(13) as
Still 'diving in' to Python, and want to make sure I'm not overlooking something.
I want to make something similiar to this but with table rows I did
I have an object with event handlers and I want to make something similar
I want to make the hostname part of this string to be variable.. Currently,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.