Добрый день! У меня есть HTML сайт (www.40auto.ru/index.html, страницу со скриптом сохранил как www[dot]40auto[dot]ru/index.php ). Хочу оживить его немного, добавив случайный вывод текста. Вот скрипт:
<?php
$settings['text_from_file'] = 'quotes.txt';
$settings['quotes'] = array(
'First quote',
'Multi
line
quote',
'Second quote',
'Third quote',
'Some text with <b>HTML</b> code!',
'Any single quotes \' must be escaped with a backslash',
'A quote with a <a href="http://www.phpjunkyard.com">link</a>!',
);
$settings['display_type'] = 0;
$settings['allow_otf'] = 1;
if ($settings['allow_otf'] && isset($_GET['type']))
{
$type = intval($_GET['type']);
}
else
{
$type = $settings['display_type'];
}
if ($settings['text_from_file'])
{
$settings['quotes'] = file($settings['text_from_file']);
}
if (count($settings['quotes']))
{
$txt = $settings['quotes'][array_rand($settings['quotes'])];
}
else
{
$txr = 'No text to choose from';
}
if ($type)
{
$txt = nl2br(trim($txt));
$txt = str_replace(array("\n","\r"),'',$txt);
echo 'document.write(\''.addslashes($txt).'\')';
}
else
{
echo $txt;
}
?>
Пока в текстовом файле quotes.txt был текст на английском языке все работало нормально. Но как только вставил в этот файл текст на русском языке, вместо букв стали появляться вопросительные знаки. Не подскажите, что нужно сделать, чтобы это исправить? Спасибо!
|