file_put_contents导致重复的条目

时间:2013-02-21 11:27:22

标签: php file-io

这是我的代码:

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两次。

在日志文件中,我找到以下内容:

  

2013年2月2日星期二12:19:34 ;;;期限
  2013年2月2日星期二12:19:35 ;;;术语

PHP版本为5.2.17。我的.htaccess文件包含:

ErrorDocument 404 /fehler_404.html

如果我把这个函数放在php文件的末尾(在</html>之后),它只被调用一次。在所有其他地方,我得到重复的条目。

你有什么想法吗?

清除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请求,在那里我提取关键字......这似乎有效,所以问题得到解答。

0 个答案:

没有答案