Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/274.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/mercurial/2.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中下载CSV时,列数据更改为不同的格式。我怎样才能阻止这一切?_Php_Csv - Fatal编程技术网

在PHP中下载CSV时,列数据更改为不同的格式。我怎样才能阻止这一切?

在PHP中下载CSV时,列数据更改为不同的格式。我怎样才能阻止这一切?,php,csv,Php,Csv,当页面加载时,我正在使用PHP在服务器中创建csv。我将数据附加到$output,它在页面加载期间创建csv。我有一个列,它的帐号类似于(6280720003789856)。它在我的网页中看起来是正确的,但当我以CSV形式下载数据时,它会自动更改为(6.28072E+15)。我怎样才能阻止这种变化 代码如下 <?php $date_from = $_REQUEST['date_from']; $date_to = $_REQUEST['date_to']; $pro

当页面加载时,我正在使用PHP在服务器中创建csv。我将数据附加到$output,它在页面加载期间创建csv。我有一个列,它的帐号类似于(6280720003789856)。它在我的网页中看起来是正确的,但当我以CSV形式下载数据时,它会自动更改为(6.28072E+15)。我怎样才能阻止这种变化

代码如下

<?php
    $date_from = $_REQUEST['date_from'];
    $date_to = $_REQUEST['date_to'];
    $procedure = "call contract_compliance_givecentral_test1('".$date_from."','".$date_to."')";
    $conn2 = new MyConnection;
    $conn2->Connect();
    $rs2 = $conn2->ExecSQL($procedure);
    $output = '';
    $givecentral_contract = "Documents/givecentral_contract.csv";
    $filename = $givecentral_contract;
    $fp = @fopen($filename, "w+");
    $totalRows_rsnf_count = mysqli_num_rows($rs2);

    if ($totalRows_rsnf_count > 0) 
    { 
    // Show if recordset not empty 
    ?>  
    <div class="container" style="padding-left: 25px!important;padding-right: 25px!important;" id="printable_area">
     <div class="head">Contract Compliance - Givecentral      
          <ul class="dashboard-icon">
             <li><a title="Export to Excel" target="_blank" href="<?php echo                          
                  $givecentral_contract ?>">
                </a>
            </li>
        </ul>
    </div>

                <div id="loader">
                        <b>Please Wait</b><img src="images/ajax-loader.gif" />
                </div>
                        <table class="data_table table table-striped display" id="example">
                            <thead>
                               <tr>
                                    <?php
                                    $amount1=0;
                                    $fields = mysqli_fetch_fields($rs2);            

                                    foreach ($fields as $val)
                                    {
                                        echo '<th>'.$val->name.'</th>';
                                         $output .='"'.$val->name;
                                         $output .= '",';
                                    }
                                    $output .="\n";
                                    ?>
                                </tr>
                            </thead>
                            <tbody>             
                            <?php
                            while($row2 = $rs2->fetch_object())
                            {
                            ?>   
                               <tr class="data_tr">
                                <?php    
                                foreach($fields as $val)
                                {
                                    $col_name = $val->name;
                                ?>
                                    <?php
                                        if($col_name == "Account No")
                                        {
                                            ?>
                                                <td style="text-align:right!important; width: 20px!important">
                                                    <?php
                                                      echo $format="$".number_format(round($row2->$col_name),2); 
                                                        $output .='"'.$format;
                                                        $output .= '",';
                                                    ?>
                                                 </td>
                                            <?php
                                        }
                                        else if(($col_name == "Charged Fee")||($col_name == "Expected Fee")))
                                        {
                                            -------
                                            -------
                                        }  
                                     ?>
                                <?php
                                }
                                $output .="\n";
                            }
                            ?>
                                </tr>
                            </tbody>
                        </table>       
                     <input type="hidden" name="report_name" value="givecentral_contract"/>             
        </div>
        <?php 
        } // Show if recordset not empty 
        else
        {  
            $type = "warning";
            $message = "<b>No records found</b>";
            include ("includes/announce.inc.php");
        } 
    ?>

合同合规性-Givecentral
请稍候
如果您想在PHP中显示它,请使用
number\u format
函数

如果Excel中出现问题,则
选择列->右键单击->格式单元格->数字选项卡
,并将格式从
常规
设置为
数字