用strtr()Examples: --------------------------------------------------- <?php $trans = array("hello" => "hi", "hi" => "hello"); echo strtr("hi all, I said hello", $trans) . "\n"; ?> ---------------------------------------------------This will show: "hello all, I said hi",
<?php
$trans = array("hello" => "hi", "hi" => "hello");
echo strtr("hi all, I said hello", $trans) . "\n";
?>
---------------------------------------------------This will show: "hello all, I said hi",
[table xxx]你没法通过strtr直接替换成<table xxxx>的。只能通过正则匹配。