为什么sprintf()在这种情况下不起作用?

jov*_*van 1 php

sprintf()在PHP中使用但它在页面上没有显示任何内容.

这是我正在做的事情:

$lang['request_paragraph']="Please check your email for a message from %s (%s). This message contains instructions for initiating the issuance of a new password for your participant number. If you did not receive the email message from %s within 10-15 minutes, please make sure that your email provider does not have a spam filter that is blocking our email from reaching your Inbox. You will not be able to receive email from us if your email provider is using a mail-blocking device. Click on the button below to send the validation email again if it appears to have been blocked or never received. You will only be able to re-send the validation email 3 more times.";

$company="Company Name";

$admin_email="admin@company.com";

sprintf($lang['request_paragraph'],$company,$admin_email,$company);
Run Code Online (Sandbox Code Playgroud)

对每个字符串执行回显会正确显示每个字符串,那么我做错了什么?

我需要使用,sprintf()因为我正在处理语言文件,它比将段落分成语言定义中的片段要简单得多.

Pet*_*ete 6

sprintf返回一个变量(一个字符串).

你需要printf

  • 哦.好.现在我觉得很傻.我实际上在其余的语言文件中使用了printf,不知道我在工作中途切换到sprintf的方式或原因.现在工作,谢谢. (2认同)