聘我网

新概念招聘3.0

Drupal里的PHP代码为何没有关闭?

vote up0vote downstar

看它的index.php,只有<?php,没有?>,第一次看到这种情况,为何要这么做?

 

2 个答复

vote up0vote downcheck

对于纯代码文件,这样做的好处是可以防止意外的输出空格

一些框架,如zend,也采用了此法

For files that contain only PHP code, the closing tag ("?>") is never permitted. It is not required by PHP, and omitting it´ prevents the accidental injection of trailing white space into the response.

链接
vote up0vote down

<?php

drupaladdjs(

'$(document).ready(function(){

$("p").fadeIn("slow");

});',

'inline'

);

?>

Paragraph one

Paragraph two

Paragraph three

链接

您的回答





不是您要找的问题? 浏览其他含有标签 的问题或者 自己问个.