• <small id='nG1e9'></small><noframes id='nG1e9'>

        <bdo id='nG1e9'></bdo><ul id='nG1e9'></ul>
    1. <i id='nG1e9'><tr id='nG1e9'><dt id='nG1e9'><q id='nG1e9'><span id='nG1e9'><b id='nG1e9'><form id='nG1e9'><ins id='nG1e9'></ins><ul id='nG1e9'></ul><sub id='nG1e9'></sub></form><legend id='nG1e9'></legend><bdo id='nG1e9'><pre id='nG1e9'><center id='nG1e9'></center></pre></bdo></b><th id='nG1e9'></th></span></q></dt></tr></i><div id='nG1e9'><tfoot id='nG1e9'></tfoot><dl id='nG1e9'><fieldset id='nG1e9'></fieldset></dl></div>
    2. <legend id='nG1e9'><style id='nG1e9'><dir id='nG1e9'><q id='nG1e9'></q></dir></style></legend>

      <tfoot id='nG1e9'></tfoot>

        文件名 feed1.xls 在 php 中不可读

        时间:2023-05-30

        <small id='nScqq'></small><noframes id='nScqq'>

          <legend id='nScqq'><style id='nScqq'><dir id='nScqq'><q id='nScqq'></q></dir></style></legend><tfoot id='nScqq'></tfoot>
            <tbody id='nScqq'></tbody>

            <i id='nScqq'><tr id='nScqq'><dt id='nScqq'><q id='nScqq'><span id='nScqq'><b id='nScqq'><form id='nScqq'><ins id='nScqq'></ins><ul id='nScqq'></ul><sub id='nScqq'></sub></form><legend id='nScqq'></legend><bdo id='nScqq'><pre id='nScqq'><center id='nScqq'></center></pre></bdo></b><th id='nScqq'></th></span></q></dt></tr></i><div id='nScqq'><tfoot id='nScqq'></tfoot><dl id='nScqq'><fieldset id='nScqq'></fieldset></dl></div>

                • <bdo id='nScqq'></bdo><ul id='nScqq'></ul>

                • 本文介绍了文件名 feed1.xls 在 php 中不可读的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想使用 zend 框架解析一个 excel 文件.我去了 Zend Developer Zone 并找到了解决方案下载 phpexcelreader.我下载了代码,在 localhost 设置了一个项目并运行代码.当我尝试读取 .xlsx 文件时,它会生成错误

                  文件名 feed1.xlsx 不可读

                  我以 .xls 格式保存文件并运行代码成功解析文件.现在我想在我用 Zend framework 开发的项目中实现这个.我创建了一个模型,并在我的项目中 require_once 像这样在我的项目顶部编辑了 excelreader.

                   require_once 'Excelreader/Excel/reader.php';类 ExcelreaderModel 扩展 Zend_Db_Table{函数读取文件(){$data = new Spreadsheet_Excel_Reader();//设置输出编码.$data->setOutputEncoding('CP1251');//$data->read('Excelreader/Excel/feed1.xls');$data->read('feed1.xls');echo '

                  ';打印_r($数据);echo '</pre>';}}

                  我在我的控制器中调用了这个模型函数.但它产生了与我使用 .xlsx 文件在 localhost 上发现的相同的错误.但我正在阅读 .xls 文件,该文件由在 localhost 上的简单项目中运行的代码解析.我也在本地运行 zend 框架.

                  我的代码有什么问题?或者有什么办法可以做同样的任务.?

                  解决方案

                  据我所知,您看到的错误是由这行代码设置的:

                  if(!is_readable($sFileName)) {$this->error = 1;返回假;}

                  由于某种原因,它无法读取您提供的文件,要么是权限/用户问题,要么是文件路径错误.

                  如果你在 *nix 服务器上,你应该确保运行网络服务器的用户有读取 excel 文件的权限.Web 服务器可能以与文件所有者不同的用户身份运行.您也可以尝试将权限设置为 666.

                  如果它只是找不到文件,提供完整路径可能会有所帮助,(例如 $data->read('/usr/local/apache2/htdocs/Excelreader/feed1.xls');

                  Hi I want to parse an excel file using zend framework. I went to Zend Developer Zone and found a solution to download phpexcelreader. I downloaded the code set a project at localhost and run the code. When I treid to read an .xlsx file it generates an error

                  The filename feed1.xlsx is not readable
                  

                  I saved the file in .xls format and run the code parsed the file successfully. Now I want to implement this in my project developed in Zend framework. I created a model, and in my project and require_onceed the excelreader at top of my project like this.

                   require_once 'Excelreader/Excel/reader.php';
                  class ExcelreaderModel extends Zend_Db_Table
                  {
                  function readFile()
                  {
                      $data = new Spreadsheet_Excel_Reader();
                  
                      // Set output Encoding.
                      $data->setOutputEncoding('CP1251');
                  
                      //$data->read('Excelreader/Excel/feed1.xls');
                      $data->read('feed1.xls');
                      echo '<pre>';
                      print_r($data);
                      echo '</pre>';
                  }
                  }
                  

                  I called this model function in my controller. But it is generating the same error which I found on localhost using .xlsx files. But I am reading .xls file which is parsed by the code running at simple project on localhost.I am also running zend framework at local.

                  What is wrong in my code? Or is there any way to do the same task.?

                  解决方案

                  As best I can tell, the error you are seeing is set by this line of code:

                  if(!is_readable($sFileName)) {
                      $this->error = 1;
                      return false;
                  }
                  

                  For one reason or another, it cannot read the file you are giving, either because there is a permissions/user issue, or the path to the file is wrong.

                  If you are on a *nix server, you should make sure the user running the webserver has permission to read the excel file. The web server probably is running as a different user than who owns the file. You can also try setting the permissions to 666.

                  If it just ins't finding the file, providing a full path may help, (e.g. $data->read('/usr/local/apache2/htdocs/Excelreader/feed1.xls');

                  这篇关于文件名 feed1.xls 在 php 中不可读的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:使用 PHPUnit 和 Zend 框架测试异常的问题 下一篇:jQuery `submit` 方法忽略使用 GET 发送的 POST.为什么?

                  相关文章

                  • <bdo id='t3TOe'></bdo><ul id='t3TOe'></ul>
                  <tfoot id='t3TOe'></tfoot>

                  <legend id='t3TOe'><style id='t3TOe'><dir id='t3TOe'><q id='t3TOe'></q></dir></style></legend>
                  1. <small id='t3TOe'></small><noframes id='t3TOe'>

                      <i id='t3TOe'><tr id='t3TOe'><dt id='t3TOe'><q id='t3TOe'><span id='t3TOe'><b id='t3TOe'><form id='t3TOe'><ins id='t3TOe'></ins><ul id='t3TOe'></ul><sub id='t3TOe'></sub></form><legend id='t3TOe'></legend><bdo id='t3TOe'><pre id='t3TOe'><center id='t3TOe'></center></pre></bdo></b><th id='t3TOe'></th></span></q></dt></tr></i><div id='t3TOe'><tfoot id='t3TOe'></tfoot><dl id='t3TOe'><fieldset id='t3TOe'></fieldset></dl></div>