Php 和 bash 一起生成密钥

Php and bash together to generate keys

我有这个 bash 文件,它生成密钥和过期时间:

#!/bin/bash
get_customer_url() {
  local IP=${1:-127.0.0.1}
  local SECRET=${2:-VERY_COOL_SECRET}
  local EXPIRES="$(date -d "today + 30 minutes" +%s)";
  local token="$(echo -n "${EXPIRES} VERY_COOL_SECRET" | openssl md5 -binary | openssl base64 | tr +/ -_ | tr -d =)"
  echo "/${token}/${EXPIRES}/"
}
get_customer_url

我通过 php 这样调用它

<?php $output = shell_exec('sh generate-keys-hls.sh'); echo "$output";?>

它工作正常,它生成类似这样的东西

/G8INKLc3VfDMYtQT2NTU-w/1530222035/ 

我的问题是我想把另一个 php 结果放在这样的行中

<?php $output = shell_exec('sh generate-keys-hls.sh'); echo "$output";?><?php echo get_post_meta($post->ID, 'file', true)?>

目前它以两行打印结果我需要它是一行而不是这个

/G8INKLc3VfDMYtQT2NTU-w/1530222035/ 
file.mp4.m3u8

我想要这样

/G8INKLc3VfDMYtQT2NTU-w/1530222035/file.mp4.m3u8

没有空格或多行!

删除 shell_exec().

结果周围的空格
echo trim($output);