Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/247.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/85.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在php函数中使用_e()?_Php_Html_Wordpress - Fatal编程技术网

如何在php函数中使用_e()?

如何在php函数中使用_e()?,php,html,wordpress,Php,Html,Wordpress,用于翻译主题和插件中的文本。但如果我有一个将文本定义为变量的php函数,该怎么办 $textoutput = 'blablabla'; 在另一个文档中,该变量被回显: echo $textoutput; 如何翻译“blabla”文本? $textoutput=_e('blabla','textdomain')不起作用 谢谢。\u e('blablabla','textdomain')用于回显到浏览器,而不是指定给变量 如果希望将其分配给变量,则需要使用另一个函数,即$variable=uu(

用于翻译主题和插件中的文本。但如果我有一个将文本定义为变量的php函数,该怎么办

$textoutput = 'blablabla';
在另一个文档中,该变量被回显:

echo $textoutput;
如何翻译“blabla”文本?
$textoutput=_e('blabla','textdomain')不起作用

谢谢。

\u e('blablabla','textdomain')用于回显到浏览器,而不是指定给变量

如果希望将其分配给变量,则需要使用另一个函数,即
$variable=uu('blablabla','textdomain')

这意味着这些代码行做同样的事情

_e( 'blablabla', 'textdomain');
echo __( 'blablabla', 'textdomain');
$variable = __( 'blablabla', 'textdomain');
echo $variable;
有关wordpress i18n的更多信息,请参见

\u e('blablabla','textdomain')用于回显到浏览器,而不是指定给变量

如果希望将其分配给变量,则需要使用另一个函数,即
$variable=uu('blablabla','textdomain')

这意味着这些代码行做同样的事情

_e( 'blablabla', 'textdomain');
echo __( 'blablabla', 'textdomain');
$variable = __( 'blablabla', 'textdomain');
echo $variable;
有关wordpress i18n的更多信息,请参阅