代码如下:
<?php
header("Content-type:text/html;charset=utf-8");
/*
* 语法结构:ucwords(string)
* 说明:把字符串中每个单词的首字符转换为大写
* 参数:string规定要转换的字符串
* 注意:首字符必须是字母才转换为大写字母
*/
$str = ucwords("hello world!");
var_dump($str);
截图如下:
运行结果如下:
本文共 261 字,大约阅读时间需要 1 分钟。
代码如下:
<?php
header("Content-type:text/html;charset=utf-8");
/*
* 语法结构:ucwords(string)
* 说明:把字符串中每个单词的首字符转换为大写
* 参数:string规定要转换的字符串
* 注意:首字符必须是字母才转换为大写字母
*/
$str = ucwords("hello world!");
var_dump($str);
截图如下:
运行结果如下:
转载于:https://blog.51cto.com/suyanzhu/2301032