PDA

View Full Version : سوال: در مورد &



se8820726
پنج شنبه 04 مهر 1392, 18:24 عصر
سلام آقا میخواستم بدونم معنیه علامت & تو نمونه کد زیر چیه ؟؟



class GreetingsController extends JController
{
/**
* Method to display the view
*
* @access public
*/
function display()
{
//This sets the default view (second argument)
$viewName = JRequest::getVar( 'view', 'list' );
//This sets the default layout/template for the view
$viewLayout = JRequest::getVar( 'layout', 'listlayout' );
$view = & $this->getView($viewName);

// Get/Create the model
if ($model = & $this->getModel('greetings')) {
//Push the model into the view (as default)
//Second parameter indicates that it is the default model for the view
$view->setModel($model, true);
}

$view->setLayout($viewLayout);
$view->display();
}
}

2undercover
پنج شنبه 04 مهر 1392, 18:40 عصر
این صفحه رو بخونید: Passing by References (http://php.net/manual/en/language.references.pass.php)

pitook
پنج شنبه 04 مهر 1392, 19:01 عصر
سلام یه مثال ساده برات میزنم امیدوارم بد دردت بخوره


<?php
$a = 5;
$b = &$a;
$a = 10;

echo $b; // 10

?>

تو مثال خودت ام فکر کنم


$this->getView($viewName)

هرجا هرچقدر بشه $view ام همون مقدارو میگیره