Suppose I write a line
include Yii::app()->basepath.'/views/email/email_friend.php';
now how can i take the response of this line into a variable?
like
$abc = include Yii::app()->basepath.'/views/email/email_friend.php';
Advertisement
Answer
Have a look at the PHP docs for include http://php.net/manual/en/function.include.php
Example #5 is I think what you’re looking for
return.php <?php $var = 'PHP'; return $var; ?> noreturn.php <?php $var = 'PHP'; ?> testreturns.php <?php $foo = include 'return.php'; echo $foo; // prints 'PHP' $bar = include 'noreturn.php'; echo $bar; // prints 1 ?>