capitalize[capi...LOGIN

capitalize[capitalize]

capitalize(capitalize the first letter of all words in the variable)

test.php:
$ smarty = new Smarty;
$smarty->assign('articleTitle', 'Police begin campaign to rundown jaywalkers.');
$smarty->display('test.html');

test.html:
{$articleTitle}
{$articleTitle|capitalize}

Output:
Police begin campaign to rundown jaywalkers.
Police Begin Campaign To Rundown Jaywalkers.


Next Section
<?php echo "capitalize(将变量里的所有单词首字大写)";
submitReset Code
ChapterCourseware