我在mysql中有一个文本列,它以yyyy-mm-dd格式存储日期值.现在,在我的php页面中,我使用此代码解析为日期值.
date("F j, Y", strtotime($row['value']));
Run Code Online (Sandbox Code Playgroud)
现在,我刚刚读到strtotime()仅在1970年1月1日之后解析值.我在该日期之前有很多日期值.有工作吗?我不想改变我的数据库结构.
我注意到了php flush(); 在Firefox 4 beta 7中不起作用,因为它适用于3.6.12.
我最近安装了firefox 4 beta 7,当调用flush()时,内容不会立即刷新.它曾经在3.6.12中正常工作.还有什么东西可以为我提供冲洗功能.
我试过了
flush();
@ob_flush();
Run Code Online (Sandbox Code Playgroud)
我还在页面顶部尝试了以下代码.
@apache_setenv('no-gzip', 1);
@ini_set('zlib.output_compression', 0);
@ini_set('implicit_flush', 1);
for ($i = 0; $i < ob_get_level(); $i++) { ob_end_flush(); }
ob_implicit_flush(1);
Run Code Online (Sandbox Code Playgroud)
顺便说一句,我在XAMPP/Apache上使用php.谢谢.
我发现将内容类型设置为text/plain工作,但它只输出纯文本而不是html内容.
我看到Lifehacker能够在使用AJAX更新部分页面时更改URL.我想这可以使用HTML5或history.js插件实现,但我想lifehacker既不使用也不使用.
有没有人知道他们是怎么做到的?我是AJAX的新手,只是设法使用Ajax更新页面的一部分.
谢谢@Robin Anderson详细的逐步算法.我试了一下它工作正常.但是,在我可以在生产中测试它之前,我想用你运行我的代码.我做对了吗?
<script type="text/javascript">
var httpRequest;
var globalurl;
function makeRequest(url) {
globalurl = url;
/* my custom script that retrieves original page without formatting (just data, no templates) */
finalurl = '/content.php?fname=' + url ;
if(window.XMLHttpRequest){httpRequest=new XMLHttpRequest}else if(window.ActiveXObject){try{httpRequest=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{httpRequest=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){}}}
/* if no html5 support, just load the page without ajax*/
if (!(httpRequest && window.history && window.history.pushState)) {
document.href = url;
return false;
}
httpRequest.onreadystatechange = alertContents;
alert(finalurl); /* to make sure, content is being retrieved from ajax …Run Code Online (Sandbox Code Playgroud) 我正在使用JQuery .get方法从网页中检索一些内容(第1页)并在主页面的div中显示它.问题是检索到的内容包含一些javascript调用.正在显示内容,但Javascript方法未执行.所有页面都引用了.js文件,因此主要文件中js的可用性不是问题.
这是主页面中的代码.页面1的URL被赋予.get函数:
$.get(url, function(response) {
var newContent = $(response).find("#right"); //Find the content section of the response
var contentWrapper = $("#wrap"); //Find the content-wrapper where we are supposed to change the content.
var oldContent = contentWrapper.find("#right"); //Find the old content which we should replace.
oldContent.replaceWith(newContent);
});
Run Code Online (Sandbox Code Playgroud)
这是第1页#right(div)中的代码
Some html tags...
<p><script type="text/javascript">abc7();</script></p>
<p><script>s(30)</script></p>
Some html tags...
Run Code Online (Sandbox Code Playgroud)
函数abc7和s在.js(普通javascript文件)中可用,该文件在所有页面的部分中被引用
s(30)应显示大小为30的文本字段.