2017-07-21 72 views
0

我想對通過Podio-Comments API添加的評論應用RTF格式(Markdown語言)。我已經添加了,但它不適合我。 我該怎麼做?如何在跑道評論中應用RTF格式,同時通過評論添加評論API

<?php 

error_reporting(0); 

require_once 'config.php'; 
include 'podio_api.php'; 
echo "START"; 

// Podio authentication 
podioAuthentication(); 
if (Podio::is_authenticated()) { 
    $ref_type = "item"; 
    $ref_id = 603929471; 
    $response = PodioComment::get_for($ref_type, $ref_id); 

    $comments = ''; 
    foreach ($response as $object) { 
     $comment = $object->value; 
     $date = $object->created_on; 
     $created_on = $date->format('Y-m-d H:i:s'); 

     // Add comment 
     $comments .= "*[Created_On]* $created_on <br /> **[Comment]** $comment <br />"; 
    } 
    $ref_id = 649113086; 
    $attributes = ['alert_invite' => FALSE, 
     'hook' => FALSE, 
     'silent' => FALSE, 
     'value' => $comments 
    ]; 
    $comment_add = PodioComment::create($ref_type, $ref_id, $attributes); 
    var_dump($comment_add); 
    echo "DONE"; 
} else { 
    echo "authentication error"; 
} 
+0

您可以發佈它的工作完美你試圖代碼... –

+0

。你能添加預期的輸出嗎? – Nikhil

+0

你可以分享結果的截圖嗎?並澄清預期的結果是什麼? –

回答

1

嘗試更換"<br />""\n"

$comments .= "*[Created_On]* $created_on \n **[Comment]** $comment \n";