"","key"=> $appkey,"dtype"=> "",);" can be used to query the dictionary."/> "","key"=> $appkey,"dtype"=> "",);" can be used to query the dictionary.">
Home >Backend Development >PHP Problem >How to query Xinhua Dictionary in PHP
How to query Xinhua Dictionary in php: 1. Create a PHP sample file; 2. Set "header('Content-type:text/html;charset=utf-8');"; 3. Configuration application appkey; 4. Query the dictionary through "$params= array("word"=> "","key"=> $appkey,"dtype"=> "",);".
The operating environment of this tutorial: Windows 7 system, PHP version 8.1, Dell G3 computer.
How to query Xinhua Dictionary in php?
Xinhua Dictionary interface calling code example based on PHP
Interface address: https://www.juhe.cn/docs/api/id/156?s= cpphpcn
Interface description: Query related information based on Chinese characters, such as pinyin, pronunciation, detailed explanation, Wubi, etc. More than 20,000 Chinese characters, including pronunciation, radicals, structure, stroke order, Wubi, English, explanation, content, polyphonic characters, etc.
Code example:
// +---------------------------------------------------------------------- //---------------------------------- // 新华字典调用示例代码 //---------------------------------- header('Content-type:text/html;charset=utf-8'); //配置您申请的appkey $appkey= "*********************"; //************1.根据汉字查询字典************ $url= "http://www.doczj.com/doc/b4219482783e0912a2162aeb.html/xhzd/query"; $params= array( "word"=> "",//填写需要查询的汉字,UTF8 urlencode编码 "key"=> $appkey,//应用APPKEY(应用详细页查询) "dtype"=> "",//返回数据的格式,xml或json,默认json );
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of How to query Xinhua Dictionary in PHP. For more information, please follow other related articles on the PHP Chinese website!