-2
前に、私は、この文字列@の後の文字列のすべてを取得し、空白
$string="@smn and @someone are web developers"
を持っていると私はそれを行うことができstring.Howから@smn
と@someone
を取得したいですか?
前に、私は、この文字列@の後の文字列のすべてを取得し、空白
$string="@smn and @someone are web developers"
を持っていると私はそれを行うことができstring.Howから@smn
と@someone
を取得したいですか?
正規表現で使用preg_match_all
/(?<!\w)@\w+/
$string="@smn and @someone are web developers";
preg_match_all('/(?<!\w)@\w+/',$string,$matches);
print_r($matches[0]);
私は、それは「配列の文字列変換に」と言うと配列を挿入するデータベースに挿入しようとすると、それがworks.Butエコーしよう( '$ IdU'、 '$ matches [0]'、 '$ Name')のクエリは$ query = $ con-> query( "INSERT INTO notifications(Post_id、Username、Initiator、type、' Date') 、 'Mention'、NOW()) "); – user6612671
'$ matches [0] [0]'または '$ matches [0] [1]'として使用すると、値が返されます – Saty
ありがとう!出来た – user6612671