Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试将 php 字符串拆分为第一个包含分隔符的部分,但第二个不包含
$string = "abc==123";
我真正想要的是得到
$string['0'] = "abc=="; $string['1'] = "123";
感谢帮助
足够简单
<?php $string = explode("==", $string); $string[0] .= "=="; ?>
我相信你想要函数strstr
http://us1.php.net/strstr
你可以使用PHP的explode函数,
$data = "abc==123"; $result = explode("==", $data); echo $result[0]. "=="; echo $result[1];