开发者

is there a way to get codeigniter to create a plain text page where \n char works properly?

I am trying to use vanilla forum with proxyconnect and it requires i give it a plain text file of my user's authentication cookie values in the form below. However, when i send it the only way i can get it to work is with the

tags and i needs to have the \n tag.

document should be:

UniqueID=5
Name=Kyle
Email=email@email.com

I can get it to display like that with br tags bu开发者_开发知识库t when i use \n tags they show up like this:

UniqueID=5\nName=Kyle\nEmail=email@email.com

here is the method in the controller

function get_user_info(){
  if(!empty($this->user)){
   printf('UniqueID=' . $this->user['userID'] . '\n');
   printf('Name=' . $this->user['userFirst'] . '\n');
   printf('Email=' . $this->user['userEmail'] . '\n');
  }
 }


Try to use use "\n" with double quotes instead. Special characters will not be expanded when they occur in single quoted strings.

Example

printf('Name=' . $this->user['userFirst'] . "\n");


Along with what rkj has suggested above, you need to output the page as plain text. To do this, add this to the beginning of your controller's function:

$this->output->set_header("Content-Type: text/plain");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜