phpの引用符の変換方法: まず、PHPのサンプルコードファイルを作成し、次にconvertQuotTo Chineseメソッドを定義し、strposやsubstrなどの関数を使用して引用符を変換し、最後にファイルを実行して変換結果を出力します。 . .

推奨: 「PHP ビデオ チュートリアル 」
php 英語の引用符を中国語の引用符に変換します。ペア
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | $test_string = 'this is a "test as" string juventus vs "napoli" is b a bing match';
echo convertQuotToChinese( $test_string );
function convertQuotToChinese( $string ) {
$flag = false;
while (false !== ( $i = strpos ( $string , '"'))) {
$begin_string = substr ( $string , 0, $i );
$end_string = substr ( $string , $i +1- strlen ( $string ));
$quot = $flag ? '”' : '“';
$flag = ! $flag ;
$string = $begin_string . $quot . $end_string ;
}
return $string ;
}
|
ログイン後にコピー
以上がPHPで英語の引用符を中国語の引用符に変換する方法の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。