如何从控制器中检索参数值以查看?

These is what I have, I'm using Codeigniter MVC.

CONTROLLER

public function index() {

    $sample = "call: 887-65-31";

    $this->load->view('contact_view', $sample);

}

now how do i retrieve it on contact view page?

Try this:

Controller

<?php

class Example extends CI_Controller {

    public function index() {
       $viewData['sample'] = "call: 887-65-31";
       $this->load->view('contact_view', $viewData);
    }
}

View

then echo in contact_view like below:

<?php 
   echo $sample;
?>

You can do something like this:

Controller:

public function index() {

    $sample['phone'] = "call: 887-65-31";

    $this->load->view('contact_view', $sample);

}

In View:

You can print $phone where you want to print.

In the controller:

public function index() {

        $sample = "call: 887-65-31";

        $this->load->view('contact_view', $sample);
}

In the view:

<?php
    echo $sample 
?>