运行页面:Warning: mb_detect_encoding() expects parameter 1 to be string, resource given in C:\xampp\htdocs\hanguo\importaction.php on line 27
文件編碼錯誤,請重新上傳!代码如下:
<?php include('config.php');?>
<?php //include('uploadcsv.php');?><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>import csv file process</title>
</head>
<body><?php
if (isset($_POST['info'])){
$file = $_FILES['csv_goods'];
$file_type = substr(strstr($file['name'],'.'),1);
if ($file_type != 'csv'){
echo '文件格式不對,請重新上傳!';
exit;
}
$handle = fopen($file['tmp_name'],"r");
//$file_encoding = mb_detect_encoding($handle,array('ASCII','GB2312','GBK','UTF-8'));
$file_encoding = mb_detect_encoding($handle); //这里是27行
if($file_encoding != 'ASCII'){
echo '文件編碼錯誤,請重新上傳!';
exit;
}
...................
...................
请各位大侠帮忙!
文件編碼錯誤,請重新上傳!代码如下:
<?php include('config.php');?>
<?php //include('uploadcsv.php');?><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>import csv file process</title>
</head>
<body><?php
if (isset($_POST['info'])){
$file = $_FILES['csv_goods'];
$file_type = substr(strstr($file['name'],'.'),1);
if ($file_type != 'csv'){
echo '文件格式不對,請重新上傳!';
exit;
}
$handle = fopen($file['tmp_name'],"r");
//$file_encoding = mb_detect_encoding($handle,array('ASCII','GB2312','GBK','UTF-8'));
$file_encoding = mb_detect_encoding($handle); //这里是27行
if($file_encoding != 'ASCII'){
echo '文件編碼錯誤,請重新上傳!';
exit;
}
...................
...................
请各位大侠帮忙!
而你
$handle = fopen($file['tmp_name'],"r");
$file_encoding = mb_detect_encoding($handle);
传递给他的确实一个资源
请问按照你的意见,我做如何修改才可以呢?非常感谢!