如何将以下对象转换为字符串:
$ssh->exec('tail -1 /var/log/playlog.csv');
所以我可以将字符串解析为 strripos() 中的第一个参数:
if($idx = strripos($ssh,','))//Get the last index of ',' substring
{
$ErrorCode = substr($ssh,$idx + 1,(strlen($ssh) - $idx) - 1); //using the found index, get the error code using substring
echo " " .$Playlist.ReturnError($ErrorCode); //The ReturnError function just replaces the error code with a custom error
}
目前,当我运行我的脚本时,我收到以下错误消息:
strpos() expects parameter 1 to be string
我见过类似的问题,包括stdClass 类的一个 Object could not be convert to string,但是我似乎仍然无法提出解决方案。