![]() |
|
首页 │ Apache │ Linux│ Java│ MySQL│ 注册│帮助 | |||
l.php 文件如下:
[PHP]
<?
@header("Content-type: text/html; charset=utf-8");
function GetLicense (){
/**
* 这里是获得服务器返回资料!
*/
$Server = $_SERVER[HTTP_HOST]=='127.0.0.1' ? "localhost" : $_SERVER[HTTP_HOST] ;
$DateIs = date("Y-m-d",time());
$Script = "";
$Script .="
<script language=\"JavaScript\">
function GetResult(hostname,TheDate)
{
if (window.XMLHttpRequest) { // Mozilla, Safari, ...
http_request = new XMLHttpRequest();
} else if (window.ActiveXObject) { // IE
http_request = new ActiveXObject(\"Microsoft.XMLHTTP\");
}
var linkurl=\"http://localhost/s.php?serverhost=\"+hostname+\"&DateIs=\"+TheDate;
//alert(linkurl);
http_request.open('GET',linkurl,false);
http_request.send(null);
//通过XMLHTTP返回数据,开始构建Div.
//var returntxt=unescape(http_request.responseText)
var returntxt=http_request.responseText;
alert(returntxt);
BuildArrib(returntxt);
}
function BuildArrib(txt)
{
ajax_license.style.display='';
document.getElementById('ajax_license').innerHTML = txt;
}
</script>
<script language=javascript>
GetResult('$Server','$DateIs');
</script>
";
return $Script;
}
echo GetLicense();
?>
[/PHP]
s.php 如下:
[PHP]
<?php
error_reporting(7);
@header("Content-type: text/html; charset=utf-8");
$TheError_txt = "
\"http://www.w3.org/TR/html4/loose.dtd\">
$TheError
";
function file_write($filename, $flag, $content) {
if (file_exists($filename)) {
if (!is_writable($filename)) {
if (!chmod($filename, 0777)) {
$TheError = "Cannot change the mode of file ($filename)";
return $TheError;
};
}
}
if (!$fp = @fopen($filename, $flag)) {
$TheError = "Cannot open file ($filename)";
}
if (fwrite($fp, $content) === FALSE) {
$TheError = "Cannot write to file ($filename)";
}
if (!fclose($fp)) {
$TheError = "Cannot close file ($filename)";
}
return $content;
}
echo file_write("1.txt","w",$TheError_txt);
?>
[/PHP]
现在我的问题是。我没有办法运行l.php后,使得建立1.txt 文件。请问为什么!!

