search

Home  >  Q&A  >  body text

Unsupported data expression: name

Follow the video method: -> field(['name' => "name", 'salary'] )

will prompt an unsupported data expression. If you change "name" There is no problem if you change it into English or use "field('name as name, salary')".


#May I ask what the reason is?


星星蓝蓝星星蓝蓝2271 days ago1845

reply all(3)I'll reply

  • 天蓬老师

    天蓬老师2018-12-07 13:49:57

    You can set the alias directly using a string

    reply
    0
  • 星星蓝蓝

    Well, there is no problem with the string, but there is a problem with the array mode setting. After looking at it, it seems to be a problem with the framework source code. The regular expression only filters English characters. Later put the framework in library/think/db/build/Mysql.php This line in: if ($strict && !preg_match('/^[\w\.\*]+$/', $key)) { Changed to: if ($strict && !preg_match('/^[\x{4e00}-\x{9fa5}\w\.\*]+$/u', $key)) { That's it.

    星星蓝蓝 · 2018-12-07 16:16:44
    星星蓝蓝

    But in your video tutorial, there is no problem if you use arrays directly. I don’t know how you set it up :)

    星星蓝蓝 · 2018-12-07 16:17:50
  • Cancelreply