我正在尝试使用标头发送信息,但我的html已经输出信息,我试图通过使用ob_start()函数来解决问题无济于事
ob_start();
require('RegisterPage.php');
if(isset($_POST['register']))
{
if(register($errormsg,$regnumber))
{
$to = $_POST['email'];
$subject = "Registration";
$txt = "You need to return to the Classic Records homepage and enter the number given in order to finish your registration ".$regnumber."";
$headers = "From: registration@greenwichtutoring.com";
mail($to,$subject,$txt,$headers);
header('Location:emailNotification.html');
}
else $error=$errormsg;
}
ob_end_flush();
Run Code Online (Sandbox Code Playgroud) 我试图从mysql访问一些信息,但我收到警告:mysql_fetch_assoc():提供的参数不是下面第二行代码的有效MySQL结果资源,任何帮助将不胜感激.
$musicfiles=getmusicfiles($records['m_id']);
$mus=mysql_fetch_assoc($musicfiles);
for($j=0;$j<2;$j++)
{
if(file_exists($mus['musicpath']))
{
echo '<a href="'.$mus['musicpath'].'">'.$mus['musicname'].'</a>';
}
else
{
echo 'Hello world';
}
}
function getmusicfiles($m_id)
{
$music="select * from music WHERE itemid=".$s_id;
$result=getQuery($music,$l);
return $result;
}
Run Code Online (Sandbox Code Playgroud) 我最近在javascript中为我的网站使用了修改后的单词计数方法,因此它计算了textarea中的初始数量单词,但它不太起作用
function wordCounter(field,countfield)
{
var maxlimit = 200;
var wordcounter = maxlimit - information.value.split(' ').length;
for (x = 0; x < field.value.length; x++)
{
if(field.value.charAt(x) == " " && field.value.charAt(x-1) != " ") // Counts the spaces while ignoring double spaces, usually one in between each word.
{
wordcounter++
}
if (wordcounter > 250)
{
field.value = field.value.substring(0, x);
}
else
{
countfield.value = maxlimit - wordcounter;
}
}
}
Run Code Online (Sandbox Code Playgroud) 一直试图将音乐上传到我的网站的服务器,但无济于事,但奇怪的是,上传图片时脚本工作正常.
if(copy($_FILES['musicFile1']['tmp_name'],"uploads/".$_SESSION['username']."/item".$s_id."/".$filename1.""))
{
if(chmod("uploads/".$_SESSION['username']."/item".$s_id."/".$filename1."", 0664))
{
$msg.= "<p>File successfully copied/p>\n";
}
else
{
$msg.= "<p>Error: failed to chmod file</p>";
}
}
else
{
$msg.= "<p>Error: failed to copy file</p>";
}
Run Code Online (Sandbox Code Playgroud)