Yii Framework Forum: [SOLVED] Why no PHP closing tag? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[SOLVED] Why no PHP closing tag? curious. many files in the sample code are missing ?> tag Rate Topic: -----

#1 User is offline   windsor 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 63
  • Joined: 04-October 11
  • Location:Tampa, FL

Posted 07 October 2011 - 02:50 PM

Some php files in the framework have no '?>' closing tag but have <?php opening tag.

When is it appropriate or required to add the closing tag?

One of many examples in the blog demo:

../protected/components/TagCloud.php

Kindly explain this convention!
0

#2 User is offline   Van Damm 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 27
  • Joined: 04-September 11
  • Location:Ukraine

Posted 07 October 2011 - 03:33 PM

Omitting closing ?> tag in files that contain only PHP code is considered a good practice.
As stated in http://framework.zen...formatting.html:

Quote

It is not required by PHP, and omitting it prevents the accidental injection of trailing white space into the response.

1

#3 User is offline   ochgar 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 25-September 12

Posted 19 November 2012 - 11:44 AM

Dear friends.

I have a problem, because all my php files in the framework have no '?>' closing tag. However I can't see any php page.



I uploaded to server host with this characteristics:

PHP Version 5.2.14
.
.
report_zend_debug On On
safe_mode Off Off
safe_mode_exec_dir no value no value
safe_mode_gid Off Off
.
.
serialize_precision 100 100
short_open_tag Off Off
.
.
.


Adding ?> tag solves the problem, but I have many php pages :(

Any suggestions are welcome

thank u.

Oswaldo
0

#4 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,346
  • Joined: 17-January 09
  • Location:Russia

Posted 20 November 2012 - 05:20 AM

That's very unusual. What do you have in server/PHP logs?
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users