Cannot modify header information - headers already sent by 我在jsp页面中嵌入了一个php,从url传过去的中文,在php中是乱码,我添加了header("Content-Type: text/html; charset=utf-8"); 结果报错 Warning: Cannot modify header information - headers already sent by 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在 header() 语句之前有输出了 把 header()放到输出之前! header前貌似不能有任何输出。 header 已经放在php文件的最上面了,不行。这个php 是被一个jsp iframe 的 <tr vAlign=top style="cursor:hand" onclick="showDetail_erpforum(<?php $row['tid'] ?>);"><script language="javascript" type="text/javascript">function showDetail_erpforum(tid){ alert("tid3333是多少 "+tid); var url = "http://10.222.1.104:8080/discuz/erp_sso.php?employeeid=<?php echo $employee_no; ?>&username_erp=<?php echo $employee_name; ?>&tid="+tid ; alert("url---"+url); window.open(url);}</script>alert()的 tid 居然是undefined 。 怎么回事啊? 我想你应该给 http://10.222.1.104:8080/discuz/erp_sso.php?employeeid=<?php echo $employee_no; ?>&username_erp=这个的代码吧。 <tr vAlign=top style="cursor:hand" onclick="showDetail_erpforum(<?php echo $row['tid'] ?>);"> <style type="text/css">.gray-dashed { border-bottom: #000 1px dashed; font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #3c3c3c; LINE-HEIGHT: 16px}.list { LINE-HEIGHT: 16px}</style><?php $employee_no = $_GET['employeeid']; $employee_name = $_GET['username_erp'];?><?php$conn = mysql_connect("10.222.1.104","root","passw0rd"); mysql_select_db("discuz"); mysql_query("set names utf8;",$conn);$sql = "select * from cdb_posts p where p.fid =26 and subject <> '' ORDER by dateline desc limit 5 ";$rs = mysql_query($sql);?><script type="text/javascript">function showDetail_erpforum(tid){ alert("tid3333是多少 "+tid); var url = "http://10.222.1.104:8080/discuz/erp_sso.php?employeeid=<?php echo $employee_no; ?>&username_erp=<?php echo $employee_name; ?>&tid="+tid ; alert("url---"+url); window.open(url);}</script><?php if(@mysql_num_rows($rs)>0){ while ($row = mysql_fetch_array($rs, MYSQL_ASSOC)) { ?> <table class=list border=0 cellSpacing=0 cellPadding=0 width="105%" align=center> <tr vAlign=top style="cursor:hand" onclick="showDetail_erpforum(<?php $row['tid'] ?>);"> <td height="10" width="10" align="right" valign="bottom"> <image width="10" height="10" src="./images/arrow.gif" /> </td> <td height=10 align="left" valign="bottom" class="gray-dashed"> <font style="font-size:12px;color:#353535"> <?php echo $row['subject'] ?> </font> </td> <td height=10 align="right" valign="bottom" class="gray-dashed"> <font style="font-size:12px;color:#353535"> <? $d=date('Y-m-d',$row['dateline']); ?> [<?echo $d; ?> </font>] </td> <td width="5"> </td> </tr> </table> <?php } mysql_close($conn); } ?> .htaccess 疑问 PHP导入到数据库字段中信息不完整 如何去掉不符合规则字符 常量问题 关于计算数字或字母与汉字混合字符串长度问题. 如何弹出数组中指定的成员 浏览的路径问题??? 从LINUX上移植到WIN2000上的PHP+MYSQL的错误。请看看。 各位老兄:请帮我看一下下面的代码 求助,关于move_uploaded_file()的问题,恳请各位爷救死扶伤 关于php socket问题 鼠标指着,弹出小菜单,在线等
把 header()放到输出之前!
<script language="javascript" type="text/javascript">
function showDetail_erpforum(tid){
alert("tid3333是多少 "+tid);
var url = "http://10.222.1.104:8080/discuz/erp_sso.php?employeeid=<?php echo $employee_no; ?>&username_erp=<?php echo $employee_name; ?>&tid="+tid ;
alert("url---"+url);
window.open(url);
}
</script>
alert()的 tid 居然是undefined 。 怎么回事啊?
.gray-dashed {
border-bottom: #000 1px dashed;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #3c3c3c;
LINE-HEIGHT: 16px
}
.list {
LINE-HEIGHT: 16px
}
</style>
<?php
$employee_no = $_GET['employeeid'];
$employee_name = $_GET['username_erp'];
?><?php
$conn = mysql_connect("10.222.1.104","root","passw0rd");
mysql_select_db("discuz");
mysql_query("set names utf8;",$conn);
$sql = "select * from cdb_posts p where p.fid =26 and subject <> '' ORDER by dateline desc limit 5 ";
$rs = mysql_query($sql);
?>
<script type="text/javascript">
function showDetail_erpforum(tid){
alert("tid3333是多少 "+tid);
var url = "http://10.222.1.104:8080/discuz/erp_sso.php?employeeid=<?php echo $employee_no; ?>&username_erp=<?php echo $employee_name; ?>&tid="+tid ;
alert("url---"+url);
window.open(url);
}
</script>
<?php if(@mysql_num_rows($rs)>0){
while ($row = mysql_fetch_array($rs, MYSQL_ASSOC)) { ?>
<table class=list border=0 cellSpacing=0 cellPadding=0 width="105%" align=center>
<tr vAlign=top style="cursor:hand" onclick="showDetail_erpforum(<?php $row['tid'] ?>);">
<td height="10" width="10" align="right" valign="bottom">
<image width="10" height="10" src="./images/arrow.gif" />
</td>
<td height=10 align="left" valign="bottom" class="gray-dashed">
<font style="font-size:12px;color:#353535">
<?php echo $row['subject'] ?>
</font>
</td>
<td height=10 align="right" valign="bottom" class="gray-dashed">
<font style="font-size:12px;color:#353535">
<? $d=date('Y-m-d',$row['dateline']); ?>
[<?echo $d; ?>
</font>]
</td>
<td width="5"> </td>
</tr>
</table>
<?php
}
mysql_close($conn);
}
?>