我有一些PHP代码.当我运行它时,会出现一条警告消息.
如何删除/禁止/忽略这些警告消息?
我有一个名为"file.txt"的文件,它通过添加行来更新它.
我正在通过这段代码阅读它:
$fp = fopen("file.txt", "r");
$data = "";
while(!feof($fp))
{
$data .= fgets($fp, 4096);
}
echo $data;
Run Code Online (Sandbox Code Playgroud)
并出现了大量的线条.我只是想回显文件的最后5行
我怎样才能做到这一点 ?
这file.txt
是这样的:
11111111111111
22222222222
33333333333333
44444444444
55555555555555
66666666666
Run Code Online (Sandbox Code Playgroud) 我想知道浏览器(即Firefox)和网站的互动.
当我将用户名和密码提交到登录表单时,会发生什么?我认为该网站向我发送了一些cookie并通过检查这些cookie来授权我.
饼干有标准结构吗?
另外,如果我想使用该cookie,如何才能看到发送到我浏览器的特定URL的cookie?
这是我的background.js文件
chrome.tabs.onUpdated.addListener(function(tabId,info, tab) {
var sites =new Array('site2','site1');
var url=tab.url;
var siteFlag=0;
for(var i in sites) {
var regexp = new RegExp('.*' + sites[i] + '.*','i');
if (regexp.test(url)) {siteFlag=1;}
};
if(siteFlag==1){
chrome.tabs.executeScript(tabId, {file:"contentscript.js"});
chrome.tabs.executeScript(tabId, {file:"jquery.js"});
chrome.tabs.insertCSS(tabId,{file:"box.css"});
}
});
Run Code Online (Sandbox Code Playgroud)
在contentscript.js中,我只需运行一个弹出框.
$(document).ready(function () {
function popup() {...}
if (window.addEventListener)
{
window.addEventListener('load', popup(), false);
}
else if (window.attachEvent)
{
window.attachEvent('onload', popup());
}
});
Run Code Online (Sandbox Code Playgroud)
有些页面有一个弹出框,有两个甚至更多的页面
问题是什么?
=============编辑==================
那些页面包含Iframe
我有一个内容的mysql表
结构在这里:
现在我有一条记录:
我想阅读并打印此表的内容为html这是我的代码:
<?php
include("config.php");
$global_dbh = mysql_connect($hostname, $username, $password)
or die("Could not connect to database");
mysql_select_db($db)
or die("Could not select database");
function display_db_query($query_string, $connection, $header_bool, $table_params) {
// perform the database query
$result_id = mysql_query($query_string, $connection)
or die("display_db_query:" . mysql_error());
// find out the number of columns in result
$column_count = mysql_num_fields($result_id)
or die("display_db_query:" . mysql_error());
// Here the table attributes from the $table_params variable are added
print("<TABLE $table_params >\n");
// optionally print a bold header at top …
Run Code Online (Sandbox Code Playgroud) 如何从字符串中删除//<![CDATA[
和结束//]]>
javascript?
var title = "<![CDATA[A Survey of Applications of Identity-Based Cryptography in Mobile Ad-Hoc Networks]]>" ;
Run Code Online (Sandbox Code Playgroud)
需要成为
var title = "A Survey of Applications of Identity-Based Cryptography in Mobile Ad-Hoc Networks";
Run Code Online (Sandbox Code Playgroud)
怎么做?
我将会话保存在/ temp目录的另一个目录中.说/session
目录.(使用session_save_path("session")
)
此外,还有一个代码可以在创建和注销10分钟后终止会话.
但我提到如果用户登录并例如关闭他的计算机,我的注销和会话销毁代码剂量不会运行,因此会话文件将保留在会话目录中.
我想知道有没有办法在/session
创建一段时间后删除会话文件?
我用这个代码
if ($handle = opendir('sessions')) {
while (false !== ($file = readdir($handle))) {
if (filectime($file)< (time()-600)) { // 600 = 10*60
unlink($file);
}
}
}
Run Code Online (Sandbox Code Playgroud)
但是,不工作,我认为它无法获得创造时间 filectime($file)
谢谢
我正在运行一个网络.这里我有一个域控制器(DC)我刚刚安装了IIS6,PHP和Mysql.一切都很好.:)
现在我想在本地网站上发布一个脚本.第一个问题是我想要检测哪个网络用户(活动目录用户)使用PHP登录.我的意思是,当用户登录到Windows时,对我来说已经足够了,不再需要其他身份验证.
我想知道我是否可以使用函数或其他东西......它的输出是AD用户名和用户组.
我们的想法是拥有一个免费下载的网站
但会有日均下载量为每一个用户拥有多个帐户(比如每用户每天5升),因此会出现用户的涨停.
我看到一个网站解决了这个问题(部分) www.gameknot.com
他们通过计算机名称或MAC地址或其他东西检测用户我不确定,我在那里注册了3个用户,他们检测到我,说:"这三个用户正在使用同一台计算机"!! 并禁止所有三个帐户.
当我重新安装另一个窗口问题解决了,我有一个用户.
所以我问自己,"他们是怎么做到的"?
关于如何处理这个问题,有什么建议吗?
在localhost win7 xampp上运行,此代码出现错误
$source = $_FILES['fupload']['tmp_name'];
$upload_dir = "invform/upload/";
if (file_exists($upload_dir) && is_writable($upload_dir)) {
move_uploaded_file( $source, $upload_dir ) or die ("Couldn't copy");
}
else {
die ('Upload directory is not writable, or does not exist.');
}
Run Code Online (Sandbox Code Playgroud)
错误是Couldn't copy
意味着目录是可写的
$source
是 : D:\\xampp\\tmp\\phpFB1.tmp
会有什么问题?
我真的很困惑PHP的正则表达式.
无论如何,我现在无法阅读整个教程的事情,因为我在html中有一堆文件,我必须尽快在那里找到链接.我提出了用PHP代码自动化它的想法,这是我所知道的语言.
所以我想我可以使用这个脚本:
$address = "file.txt";
$input = @file_get_contents($address) or die("Could not access file: $address");
$regexp = "??????????";
if(preg_match_all("/$regexp/siU", $input, $matches)) {
// $matches[2] = array of link addresses
// $matches[3] = array of link text - including HTML code
}
Run Code Online (Sandbox Code Playgroud)
我的问题是 $regexp
我需要的模式是这样的:
href="/content/r807215r37l86637/fulltext.pdf" title="Download PDF
Run Code Online (Sandbox Code Playgroud)
我想搜索并获取/content/r807215r37l86637/fulltext.pdf
上面的行,我在文件中有很多这些行.
任何帮助?
==================
标题属性对我来说很重要,我想要的所有标题都是标题
title ="下载PDF"
这是表
fid uid time
12 34 1
1 34 2
15 34 5
1 33 10
12 33 10
1 33 12
13 33 15
16 34 123
22 32 453
1 32 456
1 33 457
1 32 460
Run Code Online (Sandbox Code Playgroud)
现在我想计算每个uid
地方的数量time is >9
并且fid=1
喜欢这个
uid number of duplications
33 3
32 2
Run Code Online (Sandbox Code Playgroud)