2008年8月22日星期五

RE: [fw-mvc] controller syntax

Any and all PHP files *can* have a closing ?> but that doesn't mean that they *should*. It is the recommended practice, both in the Framework and out of it, to leave them off of the end of every PHP file for the reason I imagine you have discovered.

The reason for this is because if you have ?> and then an extra line, this extra line can cause problems as it will be interpeted as content and will cause "cannot send headers because headers have already been sent" errors (or similar - too lazy to look up actual verbiage).

Regards

----
Jeremy Brown
Senior Web Developer
Spear One
972.661.6038
www.spearone.com


-----Original Message-----
From: spaceage [mailto:davidlh@mac.com]
Sent: Friday, August 22, 2008 2:50 PM
To: fw-mvc@lists.zend.com
Subject: [fw-mvc] controller syntax


As a noob, I just learned the hard way about the problem with having a
closing "?>" in a controller file. This seems highly unorthodox, plus I
don't recall reading anything about this in the docs here...I found an
obscure reference in the "Practical Web 2.0" book.

My questions are:

1) Is it always the case that controller files DO NOT have a closing "?>"?

2) Are there other areas of the framework where you must omit the closing
"?>"?


--
View this message in context: http://www.nabble.com/controller-syntax-tp19114427p19114427.html
Sent from the Zend MVC mailing list archive at Nabble.com.

没有评论: