简体   繁体   English

如何在不同的部门拆分单词

[英]How to split words in different divisions

$name = the Stack Overflow

<div class="greyWord"> {{ $name }} </div>
<div class="blackWord"> </div>

I want the first word ' the ' in division with class name greyWord and remaining words ' Stack Overflow ' in division class blackWord我想要第一个单词 ' the ' 在分区中,类名是greyWord和剩余的单词 ' Stack Overflow ' 在分区类blackWord

something like this will work for you这样的事情对你有用

$name="the Stack Overflow";
$arr=explode(" ",$name,2);

<div class="greyWord">{{$arr[0]}}</div>
<div class="blackWord"> {{ $arr[1]}}</div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM