问题说明:
所以打破这个,Xara导出index_3.html(我改为index_3.php所以它可以解析。)Xara文档的开头看起来像这样:
<!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=Windows-1252"/>
<meta name="Generator" content="Xara HTML filter v.6.0.1.335"/>
<meta name="XAR Files" content="index_htm_files/xr_files.txt"/>
<title>index_3</title> etc....
而且我已经知道包含php已经太晚了因为输出了。 Xara在wysiwyg编辑器中使用html占位符。然后在实际的index_3.html(php)代码中,php将在文档中稍后使用,如下所示:
<div style="position: absolute; left: 47px; top: 39px; width: 503px; height: 256px; overflow: hidden;">
<div style="width: 503px; height: 256px; overflow: auto;">
<?php include 'get_opwire.php'; ?>
</div>
</div>
(至于为什么它在div上加倍我不知道)...无论如何,get_opwire.php 将显示一个类似于它的表,但它会抛出那些标题警告。另外,在index_3中,还有另一个php ..
<div style="position: absolute; left: 30px; top: 533px; width: 100px; height: 26px;">
<div style="width: 100px; height: 26px;">
<?php include 'usernameget.php'; ?>
</div>
</div>
usernameget.php拒绝显示,除非我摆脱了opwire,好像xara只想处理1个PHP包含。
所以,为了修复警告,我在上一个问题中获得了3个选项
1.) Have separate files. You would have a file like page_start.php that does includes and session_start that you include at the very
top of index_3.php, and a file like display_table.php that displays
your table that you include where the table goes.
2.) Turn the table into a function. You would wrap the table output inside a function, include get_opwire.php at the very top of
index_3.php, then call the function down where you want the table.
3.) Use output buffering. Output buffering catches the stuff printed out so that you can use it later. It would go like this:
我已经尝试了所有这三个一天,特别是选项3,但我只是刚刚将PHP放在一起。我还想从逻辑上理解为什么第二个php包含失败并知道我的实际最佳选择是什么。非常感谢帮助!
编辑:错误:
[08-Oct-2013 11:36:09] PHP Warning: session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cache limiter - headers already sent (output started at /home2/mysite/public_html/mysubsite/index_3.php:7) in /home2/mysite/public_html/mysubsite/functions.php on line 12
[08-Oct-2013 11:36:09] PHP Warning: session_regenerate_id() [<a href='function.session-regenerate-id'>function.session-regenerate-id</a>]: Cannot regenerate session id - headers already sent in /home2/mysite/public_html/mysubsite/functions.php on line 13
答案 0 :(得分:0)
session_start()
和任何其他会话操作(创建会话ID,移动会话文件夹)必须在将任何输出发送到浏览器之前完成。尝试将其作为索引/主文件的第一行,并确保它不在任何其他文件中。