php - 如何在 Flex 中对 PHP 字符串使用换行符

标签 php mysql apache-flex

这是我的 MXML

<mx:Text id="name" styleName="textStyle" maxWidth="400"></mx:Text>

然后在同一个文件中我有:

<mx:Script>
    <![CDATA[

    private function init():void
    {
       name.text = data.string;
    }

    ]]>
</mx:Script>

data.string 来自数据库,它包含以下内容:

"This is a string \n with two lines."

我也尝试过这个:

"This is a string &#13; with two lines."

它们都没有在 Flex 中创建新行,它们都以 \n 形式呈现在屏幕上。

如何使用来自数据库的字符串创建新行?

如果我在代码中输入 \n ,它会起作用:

name.text = "test \n test"; 

但如果我这样做 name.text=data.string; 即使 data.string 具有完全相同的值,它也不会。

最佳答案

我认为您可以在这个网站上找到您想要的东西。

http://www.switchonthecode.com/tutorials/flex-php-tutorial-transmitting-data-using-json

关于php - 如何在 Flex 中对 PHP 字符串使用换行符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6448510/

相关文章:

php - 写一个文本文件,用php强制下载

php - 无重复(分组依据)字段 1 循环,字段 2 位于水平线

php - 搜索已登录用户的名称

apache-flex - 如何在flex datagrid中设置备用行颜色?

actionscript-3 - 在使用 Actionscript 和 MXML 编写的 Flex 程序中调试内存泄漏的最佳方法是什么?

php - 如何过滤指定时间段内的 Facebook 潜在客户

php - mysql 中的行锁

Mysql ONLY_FULL_GROUP_BY + Join + GroupBy + Count = 无效计数

mysql - 我如何在mysql中获取日期的一周的第一天?

apache-flex - 如何让 FlashBuilder 使用自定义命名空间前缀