PHP会话有效的XHTML? [英] Valid XHTML with PHP sessions?

查看:36
本文介绍了PHP会话有效的XHTML?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,我要求获得一个实际上有效的XHTML 1.0的PHP网站

(严格)...


PHP 4.3.8: session.use_trans_sid = 1

发生的事情是验证器(不使用cookie)看到

来源中的以下内容(其中在脚本执行后从

use_trans_sid设置中放入):


....

< a href = " / statistics /?PHPSESSID = 1423fa4c27d130ea743ffd9912f60de4">

....


这会引发错误:


第48行,第139栏:文档类型不允许元素输入这里;

缺少p,h1,h2,h3,h4,h5,h6,中的一个。 div,pre,

地址,字段集,ins,del等start-tag




第66行,第194列:无法生成一般

实体的系统标识符; PHPSESSID"


任何人都有任何提示或指示来纠正这个问题吗?


-

Justin Koivisto - sp**@koivi.com

PHP海报:请使用comp.lang.php获取与PHP相关的问题,

alt.php *团体不推荐。

OK, on my quest to get one PHP site that is actually valid XHTML 1.0
(strict)...

PHP 4.3.8: session.use_trans_sid=1

What is happening is the validator (that doesn''t use cookies) sees
things like the following in the source (which are put in there from the
use_trans_sid setting after script execution):

....
<a href="/statistics/?PHPSESSID=1423fa4c27d130ea743ffd9912f60de4">
....

Which throws errors like:

Line 48, column 139: document type does not allow element "input" here;
missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre",
"address", "fieldset", "ins", "del" start-tag

and

Line 66, column 194: cannot generate system identifier for general
entity "PHPSESSID"

Anyone have any hints or pointers to correct this?

--
Justin Koivisto - sp**@koivi.com
PHP POSTERS: Please use comp.lang.php for PHP related questions,
alt.php* groups are not recommended.

推荐答案

2004年7月28日星期三16:56:29 + 0000,Justin Koivisto写道:
On Wed, 28 Jul 2004 16:56:29 +0000, Justin Koivisto wrote:
好的,我要求获得一个实际上有效的XHTML 1.0的PHP网站
(严格)......


发生的事情是验证器(不使用cookie)看到源中的以下内容(这些是在脚本执行后从
use_trans_sid设置中放入):

...
< a href =" / stat istics /?PHPSESSID = 1423fa4c27d130ea743ffd9912f60de4">
...

会抛出以下错误:

第48行,第139列:文档类型不允许元素 ;输入"这里;
缺少p,h1,h2,h3,h4,h5,h6,div, ; pre,
address,fieldset,ins,del等第66行,第194栏:无法生成一般
实体的系统标识符PHPSESSID

任何人有没有任何提示或指示来纠正这个?
OK, on my quest to get one PHP site that is actually valid XHTML 1.0
(strict)...

PHP 4.3.8: session.use_trans_sid=1

What is happening is the validator (that doesn''t use cookies) sees
things like the following in the source (which are put in there from the
use_trans_sid setting after script execution):

...
<a href="/statistics/?PHPSESSID=1423fa4c27d130ea743ffd9912f60de4">
...

Which throws errors like:

Line 48, column 139: document type does not allow element "input" here;
missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre",
"address", "fieldset", "ins", "del" start-tag

and

Line 66, column 194: cannot generate system identifier for general
entity "PHPSESSID"

Anyone have any hints or pointers to correct this?



贾斯汀,我还没有测试过这个和我的

头顶部的东西..有您尝试将HTML设置为:

< form ...>< div>

[此处为表单元素]

< ; / div>< / form>

我不知道PHP在将会话ID插入

表单区域时使用的例程,而不是看似添加它是< form>

启动行下的换行符。希望它有点忽略 < div>在< form>之后,

它最终将隐藏元素转储到< div>区域将

允许有效的XHTML(< form>不是容器等等)


可能是这样,PHP实际上会检查整个<形式...>标签和

在它之后直接插入隐藏字段,在这种情况下上面的想法

显然会失败,但是如果你没有'我会尝试自己'已经是
了。有兴趣听听这个结果如果你试试= =


问候,


Ian

-

Ian.H

digiServ网络

伦敦,英国
http://digiserv.net/


Justin, I haven''t tested this and something simply off the top of my
head.. have you tried making your HTML something like:
<form ...><div>
[ form elements here ]
</div></form>
I don''t know what routine PHP uses when inserting the session ID into a
form area other than it appears to add it to a newline under the <form>
initiation line. Hoping that it kind of "ignores" the <div> after <form>,
it''ll end up dumping the hidden element into the <div> area which will
allow for valid XHTML (<form> is not a container etc etc)

It may be that, PHP actually checks for the entire <form...> tag and
inserts the hidden field directly after it inwhich case the above idea
would obviously fail, but it''s something I''d try myself if you haven''t
already. Would be interested to hear the results of this if you do try it =)

Regards,

Ian

--
Ian.H
digiServ Network
London, UK
http://digiserv.net/


Ian .H写道:
Ian.H wrote:
2004年7月28日星期三16:56:29 +0000,Justin Koivisto写道:

On Wed, 28 Jul 2004 16:56:29 +0000, Justin Koivisto wrote:

好的,我的目的是获得一个实际上是有效的XHTML 1.0的PHP站点
(严格)......

PHP 4.3.8:session.use_trans_sid = 1
use_trans_sid设置中放入):

...
< a href =" / statistics /?PHPSESSID = 1423fa4c27d130ea743ffd9912f60de4">
...

会抛出如下错误:

L第48栏,第139栏:文件类型不允许元素输入。这里;
缺少p,h1,h2,h3,h4,h5,h6,div, ; pre,
address,fieldset,ins,del等第66行,第194栏:无法生成一般
实体的系统标识符PHPSESSID

任何人有没有任何提示或指示来纠正这个?

贾斯汀,我还没有测试过这个和我的头顶上的东西......你试过让你的HTML像:

< form ...>< div>
[此处的表单元素]
< / div>< / form>
OK, on my quest to get one PHP site that is actually valid XHTML 1.0
(strict)...

PHP 4.3.8: session.use_trans_sid=1

What is happening is the validator (that doesn''t use cookies) sees
things like the following in the source (which are put in there from the
use_trans_sid setting after script execution):

...
<a href="/statistics/?PHPSESSID=1423fa4c27d130ea743ffd9912f60de4">
...

Which throws errors like:

Line 48, column 139: document type does not allow element "input" here;
missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre",
"address", "fieldset", "ins", "del" start-tag

and

Line 66, column 194: cannot generate system identifier for general
entity "PHPSESSID"

Anyone have any hints or pointers to correct this?
Justin, I haven''t tested this and something simply off the top of my
head.. have you tried making your HTML something like:

<form ...><div>
[ form elements here ]
</div></form>




它是。关于页面的所有内容都是有效的,除非使用trans-sid。

我将其关闭以确保...

我不知道PHP使用的例程将会话ID插入
表单区域时,似乎将其添加到< form>
启动行下的换行符中。希望它有点忽略 < div>在< form>之后,
它最终将隐藏的元素转储到< div>将允许有效XHTML(< form>不是容器等)的区域

可能是,PHP实际上检查整个< form ...>标签和
直接插入隐藏的字段后,上面的想法显然会失败,但如果你还没有,我会尝试自己。如果你尝试的话,有兴趣听听这个结果=)



It is. Everything about the page is valid, except when useing trans-sid.
I turned it off to be sure...
I don''t know what routine PHP uses when inserting the session ID into a
form area other than it appears to add it to a newline under the <form>
initiation line. Hoping that it kind of "ignores" the <div> after <form>,
it''ll end up dumping the hidden element into the <div> area which will
allow for valid XHTML (<form> is not a container etc etc)

It may be that, PHP actually checks for the entire <form...> tag and
inserts the hidden field directly after it inwhich case the above idea
would obviously fail, but it''s something I''d try myself if you haven''t
already. Would be interested to hear the results of this if you do try it =)




不。 PHP将''< form ...>''替换为''< form ...>< input ... />'' - 即使

有一个FORM开始标记后的DIV元素。


它不仅仅是表单元素...在锚标签中,如果你有东西

喜欢:


< a href =" /?group = 3"> group 3< / a>


它被改变了to:


< a href =" /?group = 3& PHPSESSID = djf8fdjrigkv7eru4i4ei8h3r9f5n">第3组< / a>


它使用&而不是& amp;,并且因为它在*脚本

执行后完成*,所以没有办法在输出上简单地做一个preg_replace

缓冲区。 :\


-

Justin Koivisto - sp ** @ koivi。 com

PHP海报:请使用comp.lang.php获取与PHP相关的问题,

alt.php *不推荐使用组。



Nope. PHP replaces ''<form ...>'' with ''<form ...><input... />'' - even if
there is a DIV element after the FORM start tag.

It''s not just the form elements... In anchor tags, if you have something
like:

<a href="/?group=3">group 3</a>

it''s changed to:

<a href="/?group=3&PHPSESSID=djf8fdjrigkv7eru4i4ei8h3r9f5n"> group 3</a>

It uses "&" instead of "&amp;", and since it''s done *after* script
execution, there isn''t a way to simply do a preg_replace on the output
buffer. :\

--
Justin Koivisto - sp**@koivi.com
PHP POSTERS: Please use comp.lang.php for PHP related questions,
alt.php* groups are not recommended.


2004年7月28日星期三17:17:48 GMT,Justin Koivisto< sp ** @ koivi.com>写道:
On Wed, 28 Jul 2004 17:17:48 GMT, Justin Koivisto <sp**@koivi.com> wrote:
它不仅仅是表单元素......在锚标签中,如果你有类似的东西:

< a href =" /?group = 3"> group 3< / a>

它已更改为:

< a href =" / ?组= 3及PHPSESSID = djf8fdjrigkv7eru4i4ei8h3r9f5n">第3组< / a>

它使用&而不是& amp;,并且由于它是在执行*脚本之后完成的,所以没有办法简单地在输出
缓冲区上执行preg_replace。 :\
It''s not just the form elements... In anchor tags, if you have something
like:

<a href="/?group=3">group 3</a>

it''s changed to:

<a href="/?group=3&PHPSESSID=djf8fdjrigkv7eru4i4ei8h3r9f5n"> group 3</a>

It uses "&" instead of "&amp;", and since it''s done *after* script
execution, there isn''t a way to simply do a preg_replace on the output
buffer. :\




只需正确设置arg_separator.output即可进行排序。


-

Andy Hassall< an ** @ andyh.co.uk> / Space:磁盘使用情况分析工具
http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space



Just set arg_separator.output correctly and you''re sorted.

--
Andy Hassall <an**@andyh.co.uk> / Space: disk usage analysis tool
http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space


这篇关于PHP会话有效的XHTML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆