问题标签 [echo]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
4 回答
3417 浏览

php - PHP 日语字符串设置为?

我有一个带有一个简单回显函数的 PHP 文件:

但是当我访问该页面时,我得到了这个:

有人能帮我吗?我也将我的页面编码设置为 UTF-8,我知道,因为我使用的所有浏览器都这么说。我也在 echo 函数之前这样做:

这是做什么的?它对我有帮助吗?我所需要的只是能够回显一个静态的日语字符串。

谢谢!

0 投票
4 回答
2785 浏览

php - Echo SQL query on new page with PHP

I know this is probably a really amateur question, but I can't figure this out and I don't know much about PHP or MySQL.

So I have a really simple script that basically allows a user to submit a couple lines of text and their zipcode, then it write it to a database and returns the results on the site. It's a shoutbox essentially.

My client wants the users to be able to filter the results by zipcode. So I have it all setup, and I have a search input where people type in their zipcode, search, and then the PHP returns the submissions from that zipcode.

While I can get the results to show by themselves echoed from the PHP script, how do I get them to display within a specified div within the site? I want it essentially to store a variable, the zipcode, that a user search by, and then use that once the page refreshes to display an updated list that filters out the results that aren't from that zipcode.

Thanks so much for the help.

Chris

0 投票
3 回答
271 浏览

php - PHP 的包含/回显输出

我有两个项目正在运行,都是用 PHP 编写的。现在我想合并这两个项目。第一个项目是 CMS,在特定页面上我将显示另一个项目/应用程序的内容。我不希望第一个项目知道或访问另一个项目中的变量和函数,反之亦然。所以我只希望第一个项目 CMS 接收另一个项目的输出内容。

由于加载时间的原因,我不想发出另一个 http 请求 - 使用 get_file_contents 或 cURL。我发现passthru()并且system()很难开始工作,但如果有可能,请教我方法。

我还需要在执行时将一些变量从第一个项目传递给另一个项目,controller_id并且model_id.

提前致谢!

编辑: 考虑到可访问性指南,Iframe 和通过 javascript 加载不是一个选项。

0 投票
8 回答
277202 浏览

php - PHP 回显文本颜色

如何更改回显消息的颜色并在我编写的 PHP 中将消息居中。我的行是:

echo 'Request has been sent. Please wait for my reply!';

0 投票
6 回答
10825 浏览

shell - 在 shell 脚本中为日志添加日期前缀

我有一个带有很多 echo 语句的 shell 脚本。我想在每行输出前加上时间/日期。

所以,我更换了每个

这个比较难看。无论如何要创建一个别名(或C中#define的模拟),以使其更清洁。

显然,做类似的事情:

... 不起作用,因为在这种情况下,DATE 只计算一次,并且每个回声都具有相同的日期。

我正在考虑用打印函数调用替换每个回声,它会做前缀。我想知道是否有人有任何其他/更好的想法。

0 投票
1 回答
668 浏览

php - 使用 PHP 忽略特定字符集中的数据

不知道这叫什么,但有没有办法可以从文件中提取数据,回显它,但忽略特定字符集中的数据?

替代文字

当我回显最终函数时,是否可以忽略星号之间的数据以及星号本身?

替代文字

0 投票
4 回答
2075 浏览

php - PHP preg_replace 文本变量

我想用包含 ($) 在内的变量来回显一个字符串,如下所示:

我不希望它回显字符串的变量,我希望它回显 '$string' 本身,而不是变量的内容。我知道我可以通过在 ($) 前面添加一个“\”来做到这一点,但我想使用 preg_replace 来做到这一点。我试过了,但它不起作用:

0 投票
1 回答
1129 浏览

java - 如何在java中“回显”串口

我在我的应用程序中使用 java comm 库进行串行端口通信。当我将一些数据放在输出流上时,有时会在串口的输入流上显示相同的命令。有人知道如何回显串口吗?

0 投票
4 回答
5593 浏览

php - 在while循环中的回声中换行

再次快速提问,我确信这非常简单,但我看不出我做错了什么!

这使我的所有链接一个接一个地堆叠起来。我想在列表中订购它们,所以我尝试过:

我希望看到的最终结果是:
-Link 1
-Link 2
-Link 3
-Link 4
我做错了什么?提前致谢!

0 投票
3 回答
362 浏览

php - 字符串末尾的和号在浏览器中不可见

我正在打印一个字符串,如下所示

代码:

输出:

&words=帮助|好

请注意,最后一个&没有打印。

但是当我之后添加一个空格字符时,&它会打印如下

代码:

输出:

&words=帮助|好&

现在&打印出来了。

为什么会发生这种行为以及这种行为的原因是什么?