一个简单的网页设计 求助

lxsrmm 2011-01-11 05:32:33


这个图片是我想实现的功能
之前在朋友帮助下弄了个asp格式的,在空间内可以正常显示
可是现在空间到期换了一个,只支持php
所以求助大家以下的源码用不用做什么修改,因本人无相关知识基础,所以请直接给出最终代码
谢谢


以下为asp代码

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<%
act = Trim(Request("act"))
Select Case act
Case "list"
Call list()
Case "Add"
Call Add()
Case Else
Call list()
End Select
Sub list()
%>
<p><img src="/1.gif" width="200" height="89" /></p>
<form id="form1" name="form1" method="post" action="?act=Add">
<p>
<input name="textfield" type="text" value="输入图片显示" />
</p>
<p>
<input type="submit" name="Submit" value="提交" />
</p>
</form>
<p> </p>
<%
End Sub
Sub Add()
'StrPath = "/1.txt"
textfield = Trim(Request.Form("textfield"))
CreateFile "/1.txt",textfield
Response.Write("搞定")
End Sub



Function CreateFile(Filename,temp)
Set fso = CreateObject("Scripting.FileSystemObject")
Set tf = fso.CreateTextFile(Server.MapPath(Filename), True)
tf.write temp
tf.Close
CreateFile=true
End Function
%>
</body>
</html>


...全文
162 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
lxsrmm 2011-01-12
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 thezeus 的回复:]
PHP code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-e……
[/Quote]

从网上查找说是权限不够 可是我已经把这个文件夹以及里面所有文件的权限都改为777了 还是出现这样的信息
mulanqishi 2011-01-12
  • 打赏
  • 举报
回复
期待继续……
theZeus 2011-01-12
  • 打赏
  • 举报
回复

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<?php
$act = trim($_GET["act"]);
switch($act)
{
case "Add":
Add();
break;
default:
show();
break;
}
function show()
{
?>
<p><img src="/1.gif" width="200" height="89" /></p>
<form id="form1" name="form1" method="post" action="?act=Add">
<p>
<input id="textfield" name="textfield" type="text" value="输入图片显示" />
</p>
<p>
<input type="submit" name="Submit" value="提交" />
</p>
</form>
<p> </p>
<?php
}
function Add()
{
//$StrPath = "/1.txt";
$textfield = trim($_POST["textfield"]);
file_put_contents("1.txt",$textfield);
echo "搞定";
}

?>
</body>
</html>


昨天的代码没有测试,还是有点小错,现在已经测试绝对没错了。
除了目录要设置成777,php文件本身也要设置。
lxsrmm 2011-01-11
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 thezeus 的回复:]
PHP code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-e……
[/Quote]


首先 这么晚了 谢谢你
这是返回信息
Warning: file_put_contents(/1.txt) [function.file-put-contents]: failed to open stream: Permission denied in /home/a9555496/public_html/yanzheng.php on line 38
theZeus 2011-01-11
  • 打赏
  • 举报
回复

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<?php
$act = trim($_GET["act"]);
switch($act)
{
case "Add":
Add();
break;
default:
show();
break;
}
function show()
{
?>
<p><img src="/1.gif" width="200" height="89" /></p>
<form id="form1" name="form1" method="post" action="?act=Add">
<p>
<input name="textfield" type="text" value="输入图片显示" />
</p>
<p>
<input type="submit" name="Submit" value="提交" />
</p>
</form>
<p> </p>
<?php
}
function Add()
{
//$StrPath = "/1.txt";
$textfield = trim($_GET["textfield"]);
file_put_contents("/1.txt",$textfield);
echo "搞定";
}

?>
</body>
</html>

lxsrmm 2011-01-11
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 skyaspnet 的回复:]
以下为PHP代码:


PHP code



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<……
[/Quote]


Parse error: syntax error, unexpected ';', expecting '=' in /home/a9555496/public_html/yanzheng.php on line 13
报错。。。
skyaspnet 2011-01-11
  • 打赏
  • 举报
回复
以下为PHP代码:




<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<?php
$act = trim($_GET["act"]);
switch($act)
{
case "list":
list();
break;
case "Add":
Add();
break;
default:
list();
break;
}
function list()
{
?>
<p><img src="/1.gif" width="200" height="89" /></p>
<form id="form1" name="form1" method="post" action="?act=Add">
<p>
<input name="textfield" type="text" value="输入图片显示" />
</p>
<p>
<input type="submit" name="Submit" value="提交" />
</p>
</form>
<p> </p>
<?php

}
function Add()
{
$StrPath = "/1.txt";
$textfield = trim($_GET["textfield"]);
fput("/1.txt",$textfield);
echo "搞定";
}



function CreateFile($Filename,$temp)
{
fopen(dirname($Filename), 'w');
}
?>
</body>
</html>

4,250

社区成员

发帖
与我相关
我的任务
社区描述
国内外优秀PHP框架讨论学习
社区管理员
  • Framework
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧