Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Unix SSH服务器上的Cron作业:UTF-8编码?_Php_Unix_Utf 8_Ssh_Cron - Fatal编程技术网

Php Unix SSH服务器上的Cron作业:UTF-8编码?

Php Unix SSH服务器上的Cron作业:UTF-8编码?,php,unix,utf-8,ssh,cron,Php,Unix,Utf 8,Ssh,Cron,在PHP 5中运行时,我尝试了以下两个命令从ISO-8859-1字符串上传到链接到UTF-8网页的UTF-8数据库: $data[] = utf8_encode((string)$child); 。。。或: $data[] = convertToUtf8((string)$child); function convertToUtf8($text) { // cURL('http://'.$url); preg_match('/<meta.*?charset=(|\")(.*

在PHP 5中运行时,我尝试了以下两个命令从ISO-8859-1字符串上传到链接到UTF-8网页的UTF-8数据库:

$data[] = utf8_encode((string)$child);
。。。或:

$data[] = convertToUtf8((string)$child);

function convertToUtf8($text) {
//  cURL('http://'.$url);

    preg_match('/<meta.*?charset=(|\")(.*?)("|\")/i', $html, $matches);

    $charset = $matches[2];

    if($charset)
        return mb_convert_encoding($text, 'UTF-8', $charset);
    else
        return $text;
}   

嗯,在这一过程中,我当然探索了一些编码方面的见解,但最终,解决方案非常简单,令人尴尬

我是通过打字来完成这项工作的

php myjob.php
这是一个非初学者,因为在我的服务器上默认的版本太原始,不包含函数utf8\u encode或mb\u convert\u encodeing。因此,我现在使用以下命令启动作业:

php5.4 myjob.php
。。。它就像一个符咒。

的答案应该会让你知道如何处理这个问题。我会搜索全法语的LC_,希望你能找到更接近的答案。祝你好运
php5.4 myjob.php