Home >Backend Development >PHP Tutorial >Solution to PHP's mssql extended SQL query for Chinese field names

Solution to PHP's mssql extended SQL query for Chinese field names

WBOY
WBOYOriginal
2016-07-25 09:03:26914browse
  1. //Encoding conversion function
  2. function utf8togb($s) {
  3. return iconv('utf-8', 'gbk//IGNORE', $s); // The IGNORE parameter is Ignore characters that cannot be converted
  4. }
  5. //It is recommended to replace all Chinese fields with English aliases to facilitate the following operations and encoding conversion and other issues
  6. $sql="SELECT [id], [column] as typeid, [topic] as title, [author] as author, convert(text, [text]) as body FROM [article table];";
  7. $sql = utf8togb($sql);
  8. ?>
Copy code


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn