0
私はここに1行のコードでエラーを取得しています:ErrorExceptionを:オフセット未定義:1
$converted = preg_replace("/[^0-9.]/", "", $converted[1]);
誰がそれを引き起こしているものを知っていますか?
public function convertCurrency($amount, $from, $to) {
$url = "https://www.google.com/finance/converter?a=$amount&from=$from&to=$to";
$ch = curl_init();
$timeout = 0;
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT , "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)");
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
$rawdata = curl_exec($ch);
if ($rawdata === FALSE) {
echo "cURL Error: " . curl_error($ch);
} else {
preg_match("/<span class=bld>(.*)<\/span>/", $rawdata, $converted);
$converted = preg_replace("/[^0-9.]/", "", $converted[1]);
return number_format(round($converted, 3), 2);
}
curl_close($ch);
}
PHPコードのようです。 PHPのタグを追加するための応答を得るのに役立ちます([php])。 –
[参考 - PHPでこのエラーは何を意味しますか?](https://stackoverflow.com/questions/12769982/reference-what-does-this-error-mean-in-php) – Chris
はいphp asタイトルでAdminController.phpと書かれています は1500行以上のコードですが、ここでは1410行で終了します オープンなPHPとクローズドphpタグを持っています –