search
  • Sign In
  • Sign Up
Password reset successful

Follow the proiects vou are interested in andi aet the latestnews about them taster

Home PHP Libraries Other libraries PHP class that calls Baidu Translate
PHP class that calls Baidu Translate
<?php
class FanyiAction extends Action {
  public function _empty(){
    header("HTTP/1.0 404 Not Found");
    $this->display("Public:404");
  }
  public function index()
  {
    $User = A("Index");
    $User->head();
    $User->right();
    $User->footer();
    $this->display();
  }
  public function fanyi()
  {
    $value=$_POST['value'];
    $from="auto";
    $to="auto";
    $value_code=urlencode($value);
    $appid="xxxxxxxx";//这里填写你在百度上申请的API key
    $languageurl = "http://openapi.baidu.com/public/2.0/bmt/translate?client_id=" . $appid ."&q=" .$value_code. "&from=".$from."&to=".$to;
    $text=json_decode($this->language_text($languageurl));
    $text = $text->trans_result;
    $rs=$text[0]->dst;
    $this->assign('value',$value);
    $this->assign('rs',$rs);
    $User = A("Index");
    $User->head();
    $User->right();
    $User->footer();
    $this->display('index');
  }

Baidu Translation is an online translation service released by Baidu. It relies on the advantages of Internet data resources and natural language processing technology to help users bridge the language gap and obtain information and services conveniently and quickly.

Baidu Translation supports translation into 28 popular languages ​​around the world, including Chinese, English, Japanese, Korean, Spanish, Thai, French, Arabic, Portuguese, Russian, German, Italian, Dutch, and Greek English, Estonian, Bulgarian, Polish, Danish, Finnish, Czech, Romanian, Swedish, Slovenian, Hungarian, Vietnamese, Cantonese, classical Chinese and traditional Chinese, covering 756 translation directions.

"The world is complex, Baidu understands you better." Baidu Translate has multiple product forms such as web version and mobile APP. In addition, it also provides open cloud interface services for developers, responding to hundreds of millions of translation requests every day. . In addition to text translation, based on the diverse translation needs of users, it has launched functions such as web page translation, online definitions, massive example sentences, authoritative dictionaries, offline translation, voice translation, conversation translation, practical spoken language and photo translation, allowing users to enjoy every translation experience.

On February 28, 2013, based on mobile phone usage scenarios, Baidu Translation officially launched the Android mobile client, and on March 7, 2013, the iOS mobile client was officially released. In May 2015, the neural network translation (NMT) system was released, which is the world's first Internet NMT online product. In June 2015, the offline NMT system for mobile phones was released, supporting multiple languages ​​such as Chinese, English, Japanese and Korean. On July 5, 2016, Baidu Human Translation was officially released, providing users with paid and accurate human translation services, and is committed to more comprehensively meeting the translation needs of users in different scenarios.


Disclaimer

All resources on this site are contributed by netizens or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this site are for learning reference only. Please do not use them for commercial purposes. Otherwise, you will be responsible for all consequences! If there is any infringement, please contact us to delete it. Contact information: [email protected]

How to enable Pico.css on demand in a project without polluting styles globally How to enable Pico.css on demand in a project without polluting styles globally

09 Feb 2026

Pico.css has provided the pico.conditional.min.css version since v2, which only takes effect on elements with class="pico" added, completely solving the problem of style conflicts with other UI libraries.

What is the difference between mysql full database recovery and single database recovery_mysql operation method instructions What is the difference between mysql full database recovery and single database recovery_mysql operation method instructions

09 Feb 2026

Full database recovery is to directly import the SQL file generated by mysqldump--all-databases, covering all libraries (including system libraries). The risk is high, but it is suitable for the entire instance crash; you must check the CREATEDATABASE statement, target library list and character set, SQL mode, permission library synchronization and other details.

How to secure your MySQL server? (Security Hardening Checklist) How to secure your MySQL server? (Security Hardening Checklist)

26 Feb 2026

MySQL security hardening requires disabling anonymous users and test libraries, restricting root remote login and creating dedicated management accounts, forcing TLS encryption, closing local_infile and other dangerous functions, and regularly checking key security variables.

How to use the filter_var function for validation in PHP? How to use the filter_var function for validation in PHP?

09 Nov 2025

The filter_var() function is used to verify and clean data. It supports email, integer, URL, IP and other format verification. It is implemented through built-in filters such as FILTER_VALIDATE_EMAIL without the need for external libraries.

How to correctly load JARs with embedded dependencies (such as 'fat JARs') in Java applications How to correctly load JARs with embedded dependencies (such as 'fat JARs') in Java applications

10 Feb 2026

This article explains in detail why the "fat JAR" containing the libs/ directory cannot be directly loaded as a normal dependency, and the standardized practice plan for safely introducing external libraries in SpringBoot, Tomcat and other environments.

Best way to keep unparsed JSON fields in Go Best way to keep unparsed JSON fields in Go

01 Jan 2026

This article discusses how to decode some fields into a structure while retaining other fields not defined in the structure when using the encoding/json package to process JSON data in the Go language. We will introduce methods using the json.RawMessage type and custom Unmarshaler/Marshaler interfaces, and briefly mention solutions from other libraries to help developers flexibly handle dynamic JSON data.

Show More