Fos Rest查看回复

时间:2016-08-11 16:19:18

标签: php symfony fosrestbundle jms-serializer

我用

"name": "friendsofsymfony/rest-bundle",
"version": "1.7.7",

"name": "jms/serializer-bundle",
"version": "0.13.0"

当我的回答在Cyrilic中有一个单词时,我的回答是这样的:

return View::create()
->setStatusCode(200)
->setData($response)
->setSerializationContext(
    SerializationContext::create()
        ->setGroups(array('my_group'))
);

我收到错误:

{
    "message": "Your data could not be encoded because it contains invalid UTF8 characters.",
    "class": "RuntimeException",
    "trace": [
      {
        "namespace": "",
        "short_class": "",
        "class": "",
        "type": "",
        "function": "",
        "file": "/home/ivan/host/aog-code/vendor/jms/serializer/src/JMS/Serializer/JsonSerializationVisitor.php",
        "line": 36,
        "args": []
      },

$response是数组,但是当我使用$rest = substr("abcdef", -1);使用$shortName = $entity->getFirstName() . ($last ? ' ' . ' ' . preg_replace("/^([a-zа-я]).*$/isu", "$1", trim($last)) . '.' : '');时,我发现{{1}}之后我有一个错误的符号,并且没有错误的响应 我不明白为什么会这样。

0 个答案:

没有答案