Laravel 5.4 调用未定义函数 App\iconv()
Laravel 5.4 Call to undefined function App\iconv()
我已经将我的项目上传到服务器,现在它给我带来了问题,这可能是?,在本地项目运行完美。这是我的函数代码
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Gateway extends Model
{
function _doPost($query) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://secure.nmi.com/api/transact.php");
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS, $query);
curl_setopt($ch, CURLOPT_POST, 1);
if (!($data = curl_exec($ch))) {
return ERROR;
}
$wm_string = iconv("windows-1251", "UTF-8", $data);
parse_str(urldecode($wm_string), $result);
$data=json_encode($result, JSON_UNESCAPED_UNICODE);
curl_close($ch);
unset($ch);
$this->datos=$data;
return $this->datos;
}
}
错误是
调用未定义的函数App\iconv()
在这一行
$wm_string = iconv("windows-1251", "UTF-8", $data);
这可能是服务器问题吗?或者我必须下载一些包到我的项目中?
您可能需要请求您的托管服务提供商 give/install PHP 使用 iconv
编译。因为默认情况下 php
带有 iconv
除非在没有它的情况下显式编译。
This extension is enabled by default, although it may be disabled by
compiling with --without-iconv .
iconv:
http://php.net/manual/en/book.iconv.php
iconv installation:
http://php.net/manual/en/iconv.installation.php
我已经将我的项目上传到服务器,现在它给我带来了问题,这可能是?,在本地项目运行完美。这是我的函数代码
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Gateway extends Model
{
function _doPost($query) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://secure.nmi.com/api/transact.php");
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS, $query);
curl_setopt($ch, CURLOPT_POST, 1);
if (!($data = curl_exec($ch))) {
return ERROR;
}
$wm_string = iconv("windows-1251", "UTF-8", $data);
parse_str(urldecode($wm_string), $result);
$data=json_encode($result, JSON_UNESCAPED_UNICODE);
curl_close($ch);
unset($ch);
$this->datos=$data;
return $this->datos;
}
}
错误是
调用未定义的函数App\iconv() 在这一行
$wm_string = iconv("windows-1251", "UTF-8", $data);
这可能是服务器问题吗?或者我必须下载一些包到我的项目中?
您可能需要请求您的托管服务提供商 give/install PHP 使用 iconv
编译。因为默认情况下 php
带有 iconv
除非在没有它的情况下显式编译。
This extension is enabled by default, although it may be disabled by compiling with --without-iconv .
iconv:
http://php.net/manual/en/book.iconv.php
iconv installation:
http://php.net/manual/en/iconv.installation.php