PHP代码

<?php
$str1 = "hello world";
$str2 = "tHe lOrD oF tHe rInGs";
// 仅第一个字母大写
echo ucfirst($str1); // Hello world
// 每个单词首字母大写
echo ucwords($str1); // Hello World
// 先转小写再转首字母大写
echo ucwords(strtolower($str2)); // The Lord Of The Rings
?>

ZblogPHP模板语法

// 仅第一个字母大写
{ucfirst($str1)}
// 每个单词首字母大写
{ucwords($str2)}
// 先转小写再转首字母大写
{ucwords(strtolower($str2))}