我有这个代码,它将在我的服务器上创建 result.png:
imagepng($image, "'./result/result.png");
现在我有$text
, $type
,$id
如何使用 result_ $text
_ $id
_创建文件$type
?
例如:./result/result_123_131_1.png
;./result/result_Text_1364_3.png
这很简单:
$name = "./result/result_$text_$id_$type";
//do whatever you do to save the image and use $name as name of the file.
在 php 中,只要您有要在某些字符串文字中使用的变量,就会使用双引号。我在上面做的是将变量的值插入到字符串文字中"./result/result___"
。更多信息在这里。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句