在PHP中使用AWK的`-F,'{print $ 1}'

时间:2009-08-08 00:20:51

标签: php awk

我运行不成功

$cookie = "masi@gmail.com,777";
$cookie_tripped = trim(",", $_COOKIE['login']);
echo "Cookie: "$cookie_tripped[0];     

它给了我

Cookie: 

如何在PHP中执行以下命令?

 awk -F, '{ print $1 }'

1 个答案:

答案 0 :(得分:2)

$cookie = "masi@gmail.com,777";
$cookie_tripped = explode(",", $cookie);
echo "Cookie: " . $cookie_tripped[0];