使用curl php时会变得奇怪

时间:2017-08-23 11:14:35

标签: php curl

我在php中使用curl从网站获取数据并添加到我的mysql数据库中。 但我得到的字符串格式奇怪。我尝试了一些方法,但没有帮助我。曾经处理过的人请给我你的解决方案。

我的卷曲方法:

    function getDetailPage(){
    $detailData = grab_page("https://www.deliverynow.vn/ho-chi-minh/hanuri-quan-an-han-quoc-xo-viet-nghe-tinh");
    echo  htmlspecialchars($detailData);
}

}

获得它后,我回复html,我的方法在这里:

Món khác

我得到的html字符串更改为奇怪的字符,如:android { compileSdkVersion 26 buildToolsVersion '26.0.0' defaultConfig { targetSdkVersion 26 } ... } dependencies { compile 'com.android.support:appcompat-v7:26.0.0' } // REQUIRED: Google's new Maven repo is required for the latest // support library that is compatible with Android 8.0 repositories { maven { url 'https://maven.google.com' // Alternative URL is 'https://dl.google.com/dl/android/maven2/' } } 。但它应该是这样的: Mónkhác

1 个答案:

答案 0 :(得分:1)

使用html_entity_decode恢复字符。