これは私のコードです:
if(isset($_GET['term']) && $_GET['term'] != ""){
file_put_contents($_SERVER['DOCUMENT_ROOT'] . '/some/path/protocoll.txt', chr(10) . date('D M j H:i:s Y', time()) . ';;;' . $_GET['term'], FILE_APPEND);
}
アラートとエコーを使用しましたfile_put_contents
が、2回しか呼び出されないようです。
ログファイルには、次のものが見つかります。
Thu Feb 2 12:19:34 2013;;;term
Thu Feb 2 12:19:35 2013;;;term
PHP のバージョンは 5.2.17 です。私の.htaccess
ファイルには以下が含まれています:
ErrorDocument 404 /fehler_404.html
関数を php ファイルの最後 ( の後</html>
) に配置すると、関数は 1 回だけ呼び出されます。他のすべての場所では、エントリが重複しています。
あなたはなにか考えはありますか?
access_log を消去:
1.2.3.4 - - [21/Feb/2013:12:58:48 +0100] "GET /path/wLayout/structure/wScript.js HTTP/1.1" 200 21207 "http://www.domain.com/path/volltextsuche/suchergebnisse.php?action=search&configurationId=path.volltextsuche&term=system&button=Suchen" "Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0 FirePHP/0.7.1" www.domain.com
1.2.3.4 - - [21/Feb/2013:12:58:48 +0100] "GET /favicon.ico HTTP/1.1" 200 1150 "-" "Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0 FirePHP/0.7.1" www.domain.com
1.2.3.4 - - [21/Feb/2013:12:58:47 +0100] "GET /path/volltextsuche/suchergebnisse.php?action=search&configurationId=path.volltextsuche&term=system&button=Suchen HTTP/1.1" 200 14944 "-" "Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0 FirePHP/0.7.1" www.domain.com
1.2.3.4 - - [21/Feb/2013:12:58:48 +0100] "GET /path/wLayout/structure/wScript.js HTTP/1.1" 200 21207 "http://www.domain.com/path/volltextsuche/suchergebnisse.php?action=search&configurationId=path.volltextsuche&term=system&button=Suchen" "Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0 FirePHP/0.7.1" www.domain.com
1.2.3.4 - - [21/Feb/2013:12:58:48 +0100] "GET /path/wLayout/structure/wStyleselector.js HTTP/1.1" 200 1526 "http://www.domain.com/path/volltextsuche/suchergebnisse.php?action=search&configurationId=path.volltextsuche&term=system&button=Suchen" "Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0 FirePHP/0.7.1" www.domain.com
1.2.3.4 - - [21/Feb/2013:12:58:48 +0100] "GET /weblication/wGui/wScripts/wb_lg_cc_dd.js HTTP/1.1" 200 1848 "http://www.domain.com/path/volltextsuche/suchergebnisse.php?action=search&configurationId=path.volltextsuche&term=system&button=Suchen" "Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0 FirePHP/0.7.1" www.domain.com
1.2.3.4 - - [21/Feb/2013:12:58:48 +0100] "GET /weblication/wGui/wScripts/wb_mb_cc_dd.js HTTP/1.1" 200 11159 "http://www.domain.com/path/volltextsuche/suchergebnisse.php?action=search&configurationId=path.volltextsuche&term=system&button=Suchen" "Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0 FirePHP/0.7.1" www.domain.com
1.2.3.4 - - [21/Feb/2013:12:58:48 +0100] "GET /path/wLayout/design/style/design.css HTTP/1.1" 200 9577 "http://www.domain.com/path/volltextsuche/suchergebnisse.php?action=search&configurationId=path.volltextsuche&term=system&button=Suchen" "Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0 FirePHP/0.7.1" www.domain.com
1.2.3.4 - - [21/Feb/2013:12:58:48 +0100] "GET /path/wLayout/design/style/nav.css HTTP/1.1" 200 3914 "http://www.domain.com/path/volltextsuche/suchergebnisse.php?action=search&configurationId=path.volltextsuche&term=system&button=Suchen" "Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0 FirePHP/0.7.1" www.domain.com
1.2.3.4 - - [21/Feb/2013:12:58:48 +0100] "GET /wLayout/design/style/solr/solr_style.css HTTP/1.1" 200 1807 "http://www.domain.com/path/volltextsuche/suchergebnisse.php?action=search&configurationId=path.volltextsuche&term=system&button=Suchen" "Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0 FirePHP/0.7.1" www.domain.com
1.2.3.4 - - [21/Feb/2013:12:58:48 +0100] "GET /wLayout/design/style/solr/jquery-ui-1.9.0.custom.css HTTP/1.1" 200 30852 "http://www.domain.com/path/volltextsuche/suchergebnisse.php?action=search&configurationId=path.volltextsuche&term=system&button=Suchen" "Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0 FirePHP/0.7.1" www.domain.com
1.2.3.4 - - [21/Feb/2013:12:58:48 +0100] "GET /wLayout/structure/solr/Core.js HTTP/1.1" 200 6588 "http://www.domain.com/path/volltextsuche/suchergebnisse.php?action=search&configurationId=path.volltextsuche&term=system&button=Suchen" "Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0 FirePHP/0.7.1" www.domain.com
1.2.3.4 - - [21/Feb/2013:12:58:48 +0100] "GET /wLayout/structure/solr/Manager.jquery.js HTTP/1.1" 200 1007 "http://www.domain.com/path/volltextsuche/suchergebnisse.php?action=search&configurationId=path.volltextsuche&term=system&button=Suchen" "Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0 FirePHP/0.7.1" www.domain.com
1.2.3.4 - - [21/Feb/2013:12:58:48 +0100] "GET /wLayout/structure/solr/Parameter.js HTTP/1.1" 200 4502 "http://www.domain.com/path/volltextsuche/suchergebnisse.php?action=search&configurationId=path.volltextsuche&term=system&button=Suchen" "Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0 FirePHP/0.7.1" www.domain.com
1.2.3.4 - - [21/Feb/2013:12:58:49 +0100] "GET /wLayout/structure/solr/AbstractWidget.js HTTP/1.1" 200 2171 "http://www.domain.com/path/volltextsuche/suchergebnisse.php?action=search&configurationId=path.volltextsuche&term=system&button=Suchen" "Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0 FirePHP/0.7.1" www.domain.com
1.2.3.4 - - [21/Feb/2013:12:58:49 +0100] "GET /wLayout/structure/solr/AbstractTextWidget.js HTTP/1.1" 200 2137 "http://www.domain.com/path/volltextsuche/suchergebnisse.php?action=search&configurationId=path.volltextsuche&term=system&button=Suchen" "Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0 FirePHP/0.7.1" www.domain.com
1.2.3.4 - - [21/Feb/2013:12:58:49 +0100] "GET /wLayout/structure/solr/ResultWidget.js HTTP/1.1" 200 1158 "http://www.domain.com/path/volltextsuche/suchergebnisse.php?action=search&configurationId=path.volltextsuche&term=system&button=Suchen" "Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0 FirePHP/0.7.1" www.domain.com
1.2.3.4 - - [21/Feb/2013:12:58:48 +0100] "GET /wLayout/structure/jquery-1.9.1.min.js HTTP/1.1" 200 92629 "http://www.domain.com/path/volltextsuche/suchergebnisse.php?action=search&configurationId=path.volltextsuche&term=system&button=Suchen" "Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0 FirePHP/0.7.1" www.domain.com
1.2.3.4 - - [21/Feb/2013:12:58:49 +0100] "GET /wLayout/structure/solr/jquery.livequery.js HTTP/1.1" 200 6688 "http://www.domain.com/path/volltextsuche/suchergebnisse.php?action=search&configurationId=path.volltextsuche&term=system&button=Suchen" "Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0 FirePHP/0.7.1" www.domain.com
1.2.3.4 - - [21/Feb/2013:12:58:49 +0100] "GET /wLayout/structure/solr/PagerWidget.js HTTP/1.1" 200 7448 "http://www.domain.com/path/volltextsuche/suchergebnisse.php?action=search&configurationId=path.volltextsuche&term=system&button=Suchen" "Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0 FirePHP/0.7.1" www.domain.com
1.2.3.4 - - [21/Feb/2013:12:58:48 +0100] "GET /wLayout/structure/solr/ParameterStore.js HTTP/1.1" 200 11093 "http://www.domain.com/path/volltextsuche/suchergebnisse.php?action=search&configurationId=path.volltextsuche&term=system&button=Suchen" "Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0 FirePHP/0.7.1" www.domain.com
1.2.3.4 - - [21/Feb/2013:12:58:49 +0100] "GET /wLayout/structure/solr/AbstractFacetWidget.js HTTP/1.1" 200 8383 "http://www.domain.com/path/volltextsuche/suchergebnisse.php?action=search&configurationId=path.volltextsuche&term=system&button=Suchen" "Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0 FirePHP/0.7.1" www.domain.com
1.2.3.4 - - [21/Feb/2013:12:58:49 +0100] "GET /wLayout/structure/solr/TagcloudWidget.js HTTP/1.1" 200 1020 "http://www.domain.com/path/volltextsuche/suchergebnisse.php?action=search&configurationId=path.volltextsuche&term=system&button=Suchen" "Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0 FirePHP/0.7.1" www.domain.com
1.2.3.4 - - [21/Feb/2013:12:58:49 +0100] "GET /wLayout/structure/solr/CurrentSearchWidget.js HTTP/1.1" 200 1270 "http://www.domain.com/path/volltextsuche/suchergebnisse.php?action=search&configurationId=path.volltextsuche&term=system&button=Suchen" "Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0 FirePHP/0.7.1" www.domain.com
1.2.3.4 - - [21/Feb/2013:12:58:49 +0100] "GET /wLayout/structure/solr/TextWidget.js HTTP/1.1" 200 437 "http://www.domain.com/path/volltextsuche/suchergebnisse.php?action=search&configurationId=path.volltextsuche&term=system&button=Suchen" "Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0 FirePHP/0.7.1" www.domain.com
1.2.3.4 - - [21/Feb/2013:12:58:49 +0100] "GET /wLayout/structure/solr/AutocompleteTermWidget.js HTTP/1.1" 200 6118 "http://www.domain.com/path/volltextsuche/suchergebnisse.php?action=search&configurationId=path.volltextsuche&term=system&button=Suchen" "Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0 FirePHP/0.7.1" www.domain.com
1.2.3.4 - - [21/Feb/2013:12:58:49 +0100] "GET /wLayout/structure/solr/solr_functions.js HTTP/1.1" 200 3577 "http://www.domain.com/path/volltextsuche/suchergebnisse.php?action=search&configurationId=path.volltextsuche&term=system&button=Suchen" "Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0 FirePHP/0.7.1" www.domain.com
1.2.3.4 - - [21/Feb/2013:12:58:49 +0100] "GET /wLayout/structure/jquery-ui-1.9.0.custom.min.js HTTP/1.1" 200 235845 "http://www.domain.com/path/volltextsuche/suchergebnisse.php?action=search&configurationId=path.volltextsuche&term=system&button=Suchen" "Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0 FirePHP/0.7.1" www.domain.com
1.2.3.4 - - [21/Feb/2013:12:58:49 +0100] "GET /wLayout/structure/solr/AbstractManager.js HTTP/1.1" 200 4588 "http://www.domain.com/path/volltextsuche/suchergebnisse.php?action=search&configurationId=path.volltextsuche&term=system&button=Suchen" "Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0 FirePHP/0.7.1" www.domain.com
1.2.3.4 - - [21/Feb/2013:12:58:48 +0100] "GET /path/volltextsuche/suchergebnisse.php?action=search&configurationId=path.volltextsuche&term=system&button=Suchen HTTP/1.1" 200 28300 "-" "Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0 FirePHP/0.7.1" www.domain.com
1.2.3.4 - - [21/Feb/2013:12:58:50 +0100] "GET /wLayout/design/img/ajax-loader.gif HTTP/1.1" 200 7364 "http://www.domain.com/path/volltextsuche/suchergebnisse.php?action=search&configurationId=path.volltextsuche&term=system&button=Suchen" "Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0 FirePHP/0.7.1" www.domain.com
1.2.3.4 - - [21/Feb/2013:12:58:50 +0100] "GET /favicon.ico HTTP/1.1" 200 1150 "-" "Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0 FirePHP/0.7.1" www.domain.com
編集:
問題は、検索結果でページを更新する AJAX リクエストのようです。別の方法を見つけました。検索エンジンにリクエストを送信するファイルで、キーワードを抽出するphpファイルにajaxリクエストを行います...これはうまくいくようで、質問に答えます。