Php 删除twitter文本标题中的最后一个标签
我想在我的公共帐户的已获取twitt中获取最后一个标记 这个物体看起来像Php 删除twitter文本标题中的最后一个标签,php,twitter,Php,Twitter,我想在我的公共帐户的已获取twitt中获取最后一个标记 这个物体看起来像 Array ( [0] => stdClass Object ( [created_at] => Tue Apr 25 16:04:57 +0000 2017 [id] => 856901856584454144 [id_str] => 856901856584454144 [text] => مق
Array
(
[0] => stdClass Object
(
[created_at] => Tue Apr 25 16:04:57 +0000 2017
[id] => 856901856584454144
[id_str] => 856901856584454144
[text] => مقتل مسؤول عن التفخيخ في فتح الشام بجرد #عرسال
`https://t . co/nLuASJDXgN` #لبنان `https://t . co /oMCgiTER0A`
[truncated] =>
[entities] => stdClass Object
(
[hashtags] => Array
(
[0] => stdClass Object
(
[text] => عرسال
[indices] => Array
(
[0] => 40
[1] => 46
)
)
[1] => stdClass Object
(
[text] => لبنان
[indices] => Array
(
[0] => 71
[1] => 77
)
)
)
[symbols] => Array
(
)
我想从
text
属性中删除#hashtag,如果它位于text
的末尾,并在一个变量中准备该字符串记住任何其他标签应保持原样。有人对此有想法吗?也许可以尝试使用strrpos()
来查找最后一次出现的#?是的,我们可以使用strpos($text,“#hashtag”,-nagative offset)从末尾开始,但有时文本结尾是URL您不需要负偏移量,请使用strrpos
(注意额外的“r”)从最后开始搜索。通常你必须在它发生之前尝试一下。这是你想要的吗?