弹出的错误:Deprecated: Assigning the return value of new by reference is deprecated in E:\source\student\reader.php on line 261Warning: require_once(../Spreadsheet/Excel/oleread.php) [function.require-once]: failed to open stream: No such file or directory in E:\source\student\reader.php on line 31Fatal error: require_once() [function.require]: Failed opening required '../Spreadsheet/Excel/oleread.php' (include_path='.;C:\php5\pear') in E:\source\student\reader.php on line 31<?php 
require_once 'reader.php'; // ExcelFile($filename, $encoding); $data = new Spreadsheet_Excel_Reader(); // Set output Encoding. $data->setOutputEncoding('gbk'); 
//"data.xls"是指要导入到mysql中的excel文件 
$fileAddress=$_GET['outFile'];
$data->read('$fileAddress'); 
@ $db = mysql_connect('localhost', 'root', '') or 
die("Could not connect to database.");//连接数据库 
mysql_query("set names 'gbk'");//输出中文 
mysql_select_db('student'); //选择数据库 
error_reporting(E_ALL ^ E_NOTICE); 
for ($i = 1; $i <= $data->sheets[0]['numRows']; $i++) { 
//以下注释的for循环打印excel表数据 
/* 
for ($j = 1; $j < = $data->sheets[0]['numCols']; $j++) { 
echo """.$data->sheets[0]['cells'][$i][$j]."","; 

echo "n"; 
*/ 
//以下代码是将excel表数据【3个字段】插入到mysql中, 
$sql = "insert into studentmessage (ksh,xh,xm,xb,banj,nj,xib) values('".
  $data->sheets[0]['cells'][$i][1]."','".
  $data->sheets[0]['cells'][$i][2]."','".
  $data->sheets[0]['cells'][$i][3]."','".
              $data->sheets[0]['cells'][$i][4]."','".
              $data->sheets[0]['cells'][$i][5]."','".
              $data->sheets[0]['cells'][$i][6]."','".
  $data->sheets[0]['cells'][$i][7]."')";
  $res = mysql_query($sql); 

?>read.php和这个文件在同一路径下

解决方案 »

  1.   


         * Some basic initialisation
         */ 
        function Spreadsheet_Excel_Reader()
        {
            $this->_ole =& new OLERead();//261行
            $this->setUTFEncoder('iconv');
        }    // }}}
        // {{{ setOutputEncoding()我的路径应该怎么改呢?我都放在同一文件夹下面了
      

  2.   


    Deprecated: Assigning the return value of new by reference is deprecated in E:\source\student\reader.php on line 261
    The filename $fileAddress is not readable现在就这个错误了,应该在read()里面写一个xls的文件,但是我获得那个文件的路径的绝对路径然后写里面
        <input type="file" id="outFile"style="margin:10px 0px 0px 50px" />
        <input type="button" value="导入" id="printButton" style="margin-left:20px;" />
    $("#printButton").click(function(){
    var outFile=$("#outFile").val();
    location.href="outFile.php?outFile="+outFile;
    })
      

  3.   

    Spreadsheet与当前文件在同级目录? 如果是则改为: ./Spreadsheet/Excel/oleread.php2:去掉 & 试试。
      

  4.   

    恩 这个php文件和Spreadsheet文件夹是同级目录
      

  5.   

    The filename $fileAddress is not readable现在就这么一句提示了
      

  6.   

    我是windows系统
      

  7.   

    window下文件/文件夹的权限也不会改吗?  win7的话赋予everyone 可读/可写的权限。
      

  8.   

    先传到csdn相册里面。再插入相册图片即可。