显示函数结果为数组

时间:2018-03-09 19:39:31

标签: php

我正在尝试将数组'status'设置为函数结果

const MainDrawer = DrawerNavigator({
    OtherDrawer: DrawerNavigator({
        AccountScreen: { screen: AccountScreen }
    }, getDrawerConfig(300, 'right', 'MainScreen')),
    MenuScreen: { screen: MenuScreen }
}, getDrawerConfig(300, 'left', 'MainScreen'));

export default MainDrawer;

我需要数组'status'为“#php,#html” 尝试了很多与“和”的组合,但没有任何成功 我在这里缺少什么,有人帮助我吗?

1 个答案:

答案 0 :(得分:1)

您可以从结果中看到,您使用GetTags()函数获得了echo #php, #html return status {这不会返回任何内容值中的字符串)。您需要做的是function GetTags() { echo "#php, #html"; } $params = array( 'status' =>GetTags() ); print_r ($params); 来自函数的内容,因此它将被添加为status'值。

你的方式:

return

结果

  

#php,#htmlArray([status] =>)

注意文本首次打印在屏幕上,然后echo中没有值?

现在,function GetTags() { return "#php, #html"; } $params = array( 'status' =>GetTags() ); print_r ($params); 而不是plink -ssh -pw password -batch root@ip "ping -w 1 -c 1 server | grep -oP '\d+(?=% packet loss)' > test.txt" ing:

heroku buildpacks:add --index 1 https://github.com/heroku/heroku-buildpack-apt

结果

  

数组([status] => #php,#html)

相关问题