Tài liệu WebChat part 2

Thảo luận trong 'Căn Bản' bắt đầu bởi Thúy Viết Bài, 5/12/13.

  1. Thúy Viết Bài

    Thành viên vàng

    Bài viết:
    198,891
    Được thích:
    167
    Điểm thành tích:
    0
    Xu:
    0Xu
    As with the other CGI programs, the HTTP header is printed to let the
    Web server know that we are about to send HTML data to the Web
    browser. However, unlike most other CGI programs, Web Chat also prints
    a special code telling the Web browser not to cache the HTML during an
    active chat session. During a real-time chat, the user may reload the page
    every minute to look at the latest messages. It would be a waste of disk
    space to cache data that is constantly out of date. Thus, the Pragma: nocache
    message is delivered along with the normal Content-type:
    text/html message.
    The “no-cache” message is given only if a session form variable is set.
    This is because we want to cache the initial chat room entrance screen even
    if we do not cache the individual chat sessions. Because the messages are
    constantly changing, it is inefficient for the Web browser to constantly cache
    those pages. When the user first starts the script, no session variable has yet
    been set, and the script can use this fact to determine its course of action.
    print Content-type: text/html
    ;
    if ($in{'session'} ne ) {
    print Pragma: no-cache
    ;
    } else {
    print
    ;
    }
     

    Các file đính kèm:

Đang tải...
Chủ đề tương tự
  1. Thúy Viết Bài

    Tài liệu WebChat part 1

    Thúy Viết Bài, 5/12/13, trong diễn đàn: Căn Bản
    Trả lời:
    0
    Xem:
    240
  2. Thúy Viết Bài

    Tài liệu WebChat part 3

    Thúy Viết Bài, 5/12/13, trong diễn đàn: Căn Bản
    Trả lời:
    0
    Xem:
    409
  3. Thúy Viết Bài

    Tài liệu WebChat part 4

    Thúy Viết Bài, 5/12/13, trong diễn đàn: Căn Bản
    Trả lời:
    0
    Xem:
    620
  4. Thúy Viết Bài
    Trả lời:
    0
    Xem:
    171
  5. Thúy Viết Bài
    Trả lời:
    0
    Xem:
    297