2017-10-13 7 views

答えて

1

$ s2文字列をUTF-8にエンコードするとうまくいくはずです。

あなたはutf8_encode(string)

<?php 
$s2 = file_get_contents("s2.txt"); 
?> 
<div id="slogan"> 
<em>asd</em> 
<strong><?php echo utf8_encode($s2); ?></strong> 
<span>dsa</span> 
</div> 

PHP関数とこれはあなたのためにそれを修正する必要があることを行うことができます。

+0

に文字列をエンコードします。 – MadsBinger

0

次のスニペットを試すことができます。

function file_get_contents_utf8($fn) { 
    $content = file_get_contents($fn); 
     return mb_convert_encoding($content, 'UTF-8', 
      mb_detect_encoding($content, 'UTF-8, ISO-8859-1', true)); 
} 

$s2 = file_get_contents_utf8("s2.txt"); 

それは、これはあなたのためのより良いうまくいく場合にも、代わりに)(のfile_get_contentsをエンコードすることができますUTF8

関連する問題