C 語言撰寫 CGI 時的常用函數

CGI 程式設計

第一個程式

環境變數

get 參數

post 參數

常用函數

參數解碼

範例:檔案編輯

Apache 安裝

訊息

相關網站

參考文獻

最新修改

簡體版

English

#include "cgiutil.h"

void replace(char *str, char cFrom, char cTo) {
    for(x=0;str[x];x++) 
      if(str[x] == cFrom) 
        str[x] = cTo;
}

void unescape_url(char *url) {
    register int x,y;
    for(x=0,y=0;url[y];++x,++y) {
        if((url[x] = url[y]) == '%') {
            sscanf(&url[y+1], "%2x", url[x]);
            y+=2;
        }
    }
    url[x] = '\0';
    replace(str, '+', ' ');
}
#ifndef CGIUTIL_H
#define CGIUTIL_H

void unescape_url(char *url);
void replace(char *str, char cFrom, char cTo);

#endif

Facebook

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License