$response
變種有一個名爲custom_test_name
組件,它看起來象下面這樣:限制回聲,以獲得所需的字符
[Test_Name]ad.no.check1.check2.check3
,這裏是小PHP代碼:
<?php
echo "<class="."com.tests.".$response["custom_test_name"][1]."</class>";
?>
這版畫<class=com.tests.[</class>
..檢查第一個字符[
的custom_test_name
和類似的回顯["custom_test_name"][2]
打印T
,[3]
打印e
....但是,如何在這種情況下只打印/回顯具體細節?例如。只是迴應這ad.no.check1.check2.check3
並消除了那[Test_Name]
。有沒有一種方法可以指定範圍/其他方法?
這取決於。如果你事先知道'[]'中的文本,你可以使用['str_replace()'](http://php.net/manual/en/function.str-replace.php),否則你必須使用['preg_replace()'](http://php.net/manual/en/function.preg-replace.php) – fusion3k