这是我的代码:
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 请求,我在其中提取关键字......这似乎有效,因此问题得到了回答。