Questions tagged [ob-get-contents]
47 questions
17
votes
4 answers
How does ob_get_contents work in Php?
This is a sample code from the book I am reading:
ob_start();
include("{$path}.ini");
$string = ob_get_contents();
ob_end_clean();
$pairs = parse_ini_string($string);
My question is, how does ob_get_contents() know what to get contents from?…

Koray Tugay
- 22,894
- 45
- 188
- 319
8
votes
3 answers
ob_start() within a loop
I've got a problem when looping using foreach() loop and inside of this loop using ob_start() and ob_get_clean().
Here's my function:
protected function renderEmail() {
$template = $this->_case.".php";
if(is_file($this->_dir.DS.$template)) {
…

user398341
- 6,339
- 17
- 57
- 75
4
votes
2 answers
How to return php code from mysql record?
How to return php code from mysql row 'content' record where it might contain just plain text like:
Hello!
or/and php like:
Lets try some php:
without casing speed performance when it contains just plain text?
Here is…

Binyamin
- 7,493
- 10
- 60
- 82
4
votes
1 answer
PHP Output Buffer Getting White Screen & No Errors On Method Return
I have been using PHP for a very long time and for some reason migrating to a new server has caused a White Screen of Death. Obviously it must be because of a version difference. I have been using the same output buffer pattern for…

GoreDefex
- 1,461
- 2
- 17
- 41
3
votes
2 answers
Php buffer output, css and mail
Currently I have a script that send some mail, the script result are a couple html tables:
$from = "prueba.com ";
$to = "myemail@gmail.com";
echo "
";
$contenido = ob_get_contents();
echo "
";
$cabeceras =…
JuanFernandoz
- 805
- 17
- 40
2
votes
2 answers
Multiple instances breaks WordPress shortcode
I wrote a shortcode that displayed author profiles based on id. For example [user-profile id="1"] would display the profile block defined in user-profile.php for author 1. It worked (even with multiple instances on the same page).
function…

ryanve
- 50,076
- 30
- 102
- 137
1
vote
2 answers
(PHP) How to pass the previous INCLUDE / REQUIRE calls into child files?
I'm creating my own Templating Script by using the ob_get_contents() as a core method. By using it, it can render out the other files, calling from the one single file.
Just like, lets assume we have 4…

夏期劇場
- 17,821
- 44
- 135
- 217
1
vote
1 answer
Using Import-csv and store multiple values of a column as a variable
I have a csv file that has a column named 'art':
sequence art last first address city st zip
-------- --- ---- ----- ------- ---- -- ---
1 3S Doe John 123 Any Street AnyTown
6 3S Doe John 128 Any Street…

cnjfo672
- 45
- 5
1
vote
1 answer
allow ob_get_contents and to grab warnings but not display them in front end
I have a script developed in PHP7.2 running on a CentOS machine and I've been struggling to get ob_get_contents to work.
In the php.ini file, I have set display_errors to Off and error_reporting to this:
error_reporting = E_ALL & ~E_NOTICE
Here's…

Matias
- 539
- 5
- 28
1
vote
1 answer
PHP ob_get_contents is empty
I am using ob_start() and ob_get_contents() to setup a cache. It all works fine on my Windows desktop test machine, but when I run it on the live host ob_get_contents() is empty. The print data is derived from a series of php includes. When I dont…

mikeruss
- 11
- 2
1
vote
0 answers
How to get nicEdit textarea content in ng-model?
I'm new in Angular and html development. So i don't know yet all features and code terms.
I created a form which contains a rich textarea field. I used nicEdit as this is the one recommended by mycompany (so cannot change of editor).
As you can see…

K. Gratiot
- 31
- 2
1
vote
0 answers
How get content of image using ob_get_contents
I'd like to get the content of the file from imagePng(), on my code, it returns empty.
Just for a test, if I remove the ob_end_clean() and it's printing the content but I don't know how can I getting it. I guess I'm missing something in my…

user2918057
- 189
- 1
- 12
1
vote
2 answers
ob_get_contents stopped working for some unknown reason
This script worked fine for a few weeks then stopped working for no reason.
1.

Nathan
- 13
- 2
1
vote
1 answer
Add span inside anchor output using PHP's ob_get_contents function
What I have:
A PHP function that outputs a log in/out link based on whether the user is correspondingly logged in/out.
bar
What I need:
I need a span wrapped around the link text inside the anchor element.

Clarus Dignus
- 3,847
- 3
- 31
- 57
1
vote
1 answer
ob_get_content() output incorrect
I'm experiencing some problems with ob_start function, probably due to the new PHP 5.5
What I'm trying to do is render some PHP from a third file using inside ob_start.
Here the code:
function fetch()
{
extract($this->a_vars); // Extract the…

user3363963
- 21
- 2