1
这里是我的代码和它的工作为何此通知错误?
<?php
$num = 5;
$location = 'tree';
define(format,'There are %d monkeys in the %s');
echo sprintf(format, $num, $location);
?>
,但我发现
注意使用未定义的常量格式的 - 假设“格式化”的行号6
有树中有5只猴子
为什么?
你用'format'为常量,而不是字符串。用作'define('format','%s中有%d个猴子'); – Gunasegar