如何在PHP中创建Object?

时间:2018-05-09 07:23:18

标签: php object

我想知道如何创建对象,如下例所示。请帮我创建对象。我在谷歌搜索但我没有得到我想要的东西。我是诺布。

{
    "ERROR_CODE" = 0;
    "M_USER" = {
        "CREATE_DATE" = "2018-05-09 13:57:49";
        "CREATE_USER_ID" = t1074567;
        "FACE_PICTURE_FILE_PATH" = "<null>";
        "MAIL_ADDRESS" = "Testing@gmail.com";
        "NATIVE_LANGUAGE_CD" = 102;
        "REQ_LANGUAGE_CD" = 102;
        "TERMINAL_ID" = "C71B456F-EA16-4734-8C9B-00B0856143DA";
        "TERMINAL_TYPE" = 1;
        "TOTAL_GRADE" = 0;
        "TRANSLATABLE_FLG" = 1;
        "UPDATE_DATE" = "2018-05-09 13:57:49";
        "UPDATE_USER_ID" = tdu1074567;
        "USER_ID" = tdu1074567;
        "USER_NAME" = Testing;
        "USER_PWD" = testing123;
        "VALID_FLG" = 1;
    };
    "TRANS_LANGUAGE" = (
        {
            C = 102;
            L = 10203;
        },
        {
            C = 101;
            L = 10101;
        }
    );
}  

2 个答案:

答案 0 :(得分:7)

这是一个解决方案

$newObject = new stdClass;

$newObject->ERROR_CODE = 0;
$newObject->M_USER = new stdClass;
$newObject->M_USER->CREATE_DATE = "2018-05-09 13:57:49";

等等。

答案 1 :(得分:2)

df_L <- df %>%
  gather(key = "Month", value = "Value", X1:X36) %>%
  mutate(Month = as.numeric(str_replace(Month, "X", "")))