-2
<?php if (!empty(cutstr($node->content,300))) : ?>
<div class="pr_teaser">
<?php echo cutstr($node->content,300); ?>
</div>
<?php endif; ?>
代碼有什麼問題? cutstr
功能沒問題。我的IDE對此行提醒<?php if (!empty(cutstr($node->content,300))) : ?>
是錯誤的?但我找不到錯誤。代碼有什麼問題?
是什麼讓你覺得有什麼錯呢? (即,你期望輸出什麼,你會得到什麼輸出?) – Quentin 2011-04-11 08:22:54
絕對錯誤的是你沒有使用'htmlspecialchars()'來轉義輸出。 – Tomalak 2011-04-11 08:25:29
閱讀文檔有助於:http://php.net/manual/en/function.empty.php。請注意該筆記。 – 2011-04-11 08:26:50