你可以通過charlist參數指定你想去除的字元。Simply list all characters that you want to be stripped. With .. you can specify a range of characters.
例1. trim()例子
$text = "\t\tThese are a few words :) ... "; $trimmed = trim($text); // $trimmed = "These are a few words :) ..." $trimmed = trim($text," \t."); // $trimmed = "These are a few words :)" $clean = trim($binary,"\0x00..\0x1F"); // trim the ASCII control characters at the beginning and end of $binary // (from 0 to 31 inclusive)