php多行文本
我有一个运行php的Web服务器,它使用php配置文件来绘制main index.php页面,我正在尝试清理它,就像:php多行文本,php,html,Php,Html,我有一个运行php的Web服务器,它使用php配置文件来绘制main index.php页面,我正在尝试清理它,就像: $config['p1'] = 'Line one text'; $config['p2'] = 'Line 2 text'; $config['p3'] = 'Line 3 text'; 在索引上,我有很多类似的东西: echo $p1; echo $p2; echo $p3; 我想澄清一下,如何使用我的配置文件使它使用一个这样的配置文本集输出多行,但idk如何确切地做
$config['p1'] = 'Line one text';
$config['p2'] = 'Line 2 text';
$config['p3'] = 'Line 3 text';
在索引上,我有很多类似的东西:
echo $p1;
echo $p2;
echo $p3;
我想澄清一下,如何使用我的配置文件使它使用一个这样的配置文本集输出多行,但idk如何确切地做到这一点
$config['p1] = 'this is text on line 1',
'this is text on line 2',
'this is final line of text';
因此,用户看到的html页面上的输出如下所示
this is text on line 1
this is text on line 2
this is final line of text
但是那不行我怎么能做我想做的事?或者,用我的方式使用php是不可能的
$config['p1] = 'this is text on line 1',
'this is text on line 2',
'this is final line of text';
语法错误:PHP不理解。应该是
$config['p1'] = 'this is text on line 1'."<br>\n".
'this is text on line 2'."<br>\n".
'this is final line of text';
因为在PHP中,字符串可以在多行上
要输出字符串,请使用
echo $config['p1']
请改正你的拼写。你的问题很难理解。这里有一些基本的东西。如果你想在HTML中使用换行符,你需要使用HTML换行符…请定义清理。清理我的意思是我不想要所有的配置p1 p2 p3 ect我想要一个p1并在页面上输出多行这对我不起作用,它只是把它全部放在我的索引页上echo$config['p1']所在的一行。这样:这是第一行的文本
这是第二行的文本。。。。ect它实际上打印在用户看到的页面上
echo $config['p1']