XAMPP有两种模式, 一种是不建立服务的, 那么需要点一下Apache才启动
另一种是建立服务的, 开机自动启动Apache.
但是建立服务以后可能导致COM组建不正常, 抛出如下错误
[2147614729]com_exception in File.php line 555
.....
$word->ActiveDocument;
解决方法是不使用XAMPP的服务模式.
原因可能是服务模式使用的不是系统默认账号, 以至于COM不认识了.
XAMPP有两种模式, 一种是不建立服务的, 那么需要点一下Apache才启动
另一种是建立服务的, 开机自动启动Apache.
但是建立服务以后可能导致COM组建不正常, 抛出如下错误
[2147614729]com_exception in File.php line 555
.....
$word->ActiveDocument;
解决方法是不使用XAMPP的服务模式.
原因可能是服务模式使用的不是系统默认账号, 以至于COM不认识了.
示例代码如下
<?php
$txt = file_get_contents($file);
// 搞到实际编码
$encoding = mb_detect_encoding($txt, array('GB2312', 'GBK', 'UTF-16', 'UCS-2', 'UTF-8', 'BIG5', 'ASCII'));
// 转换
$txt = iconv($encoding, 'UTF-8//IGNORE', $txt);
就是说价格//IGNORE可能解决
示例代码如下
<?php
$file = fopen('kw2.csv', 'r');
//按行读取
while ($line = fgetcsv($file))
$data[] = $line;
fclose($file);
echo '<pre>';
print_r($data);