我试图从我的web应用程序插入谷歌日历中的事件描述,我不能\ n或<br />
被解释为换行符。 Google日历如何解释换行符?帮助将不胜感激!Google Calendar API的换行符?
4
A
回答
-1
“/ n”仅适用于iCal条目。使用Google Calendar API,您不能执行换行。
0
我不确定谷歌日历是如何解释新行,但似乎每行有121个字符。
所以说,你想把“地址:”/ n的细节谷歌日历。
以121减去“地址:”的字符数并将113个空格添加到“地址:”
以下文本应在新行上。
如果您发送的文本是一个PHP变量,在PHP中创建新行更容易。
$description = 'Description:'.'\n';
然后谷歌日历将它作为一个新行读取它。
1
您是否使用特定的客户端库?如果使用的协议,简单地将新行的内容元素应该工作:
<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom"
xmlns:gCal="http://schemas.google.com/gCal/2005"
xmlns:gd="http://schemas.google.com/g/2005">
<title type="text">Event with new line</title>
<content type="text">This is an event with one
two
three
and and four lines.</content>
<gd:when endTime="2011-12-23T10:00:00.000-07:00"
startTime="2011-12-23T08:00:00.000-07:00"/>
</entry>
如果使用客户端库,使用“\ n”应该正常工作。
1
Heredocs是我如何运作的。
$content = <<<EOT
This
is
my
content
EOT;
您不能定界符的内部循环,但你可以建立起来,像这样
$content = '';
for ($vars as $var) {
$content .= <<<EOT
$var
EOT;
}
1
使用API V3,这个工作对我来说:
$full_description .= 'Evento organizado por: ' . $area_responsavel . "\n\n"; $full_description .= $mensagem;
+1
单个“\ n”为我工作。虽然使用双引号很重要! (单引号不起作用) – tiho
1
用这个在google日历事件描述中创建一个换行符:
\\n
兰德尔麦格林写在注释中正确答案:
我敢肯定,一些在过去3年中已经改变,因为这个问题被问,但你现在可以做到这一点。你只需要为JSON格式化你的字符串。 “\ n”变成“\ n”。
相关问题
- 1. Google Calendar API V3
- 2. Google Calendar API getRefreshToken
- 3. Google Calendar Ruby API
- 4. Google Calendar API ClassDefNotFoundException
- 5. Google Calendar API,Google_Service类
- 6. Google Calendar API Javascript Quickadd
- 7. Google Calendar API集成
- 8. Google Calendar API和Coldfusion
- 9. Google App Engine和Google Calendar API
- 10. Google Calendar API V3删除API
- 11. Google Calendar API中的“keyExpired”
- 12. Spring3的Google Calendar API库?
- 13. Google Calendar API与会者VB
- 14. Google Calendar Api Android:403错误
- 15. Zend GData,Google Calendar API问题
- 16. Google Calendar API Python文档
- 17. 如何实施Google Calendar API
- 18. Google Calendar API日期时间
- 19. 如何获得Google Calendar API?
- 20. Google Calendar API V3 - 与会者
- 21. Google Calendar API - PHP - “Class'apiClient'not found”
- 22. Google Calendar v3 api添加ExtendedProperties
- 23. Google Calendar API活动地点
- 24. Google Calendar API刷新accessToken
- 25. Google Calendar API适用性
- 26. Google Calendar API与Asp.net集成
- 27. Google Calendar API v3 PHP和JSON
- 28. Google Calendar API事件插入
- 29. Java中的安全API AuthSub(Google Calendar API)
- 30. Calendar Calendar like Google Calendars
所以它不可能有事件描述的换行符...? – Ben
通过Google API,是的。通过iCal界面,您可以使用“\ n” –
我确信在问题提出后的过去3年中发生了一些变化,但您现在可以做到这一点。你只需要为JSON格式化你的字符串。 “\ n”变成“\\ n”。这是一个有用的C#函数来做到这一点: http://stackoverflow.com/questions/1242118/how-to-escape-json-string/21455488#21455488 – Vandel212