PHP code example of amashigeseiji / viewvalue

1. Go to this page and download the library: Download amashigeseiji/viewvalue library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

amashigeseiji / viewvalue example snippets


#Load ViewValue plugin
CakePlugin::load('ViewValue');

public $helpers = array('ViewValue.ViewValue');

#Controller/SampleController.php
public function index() {
	$this->set('xssstr', '<script>alert(0)</script>');
}

#Controller/SampleController.php
public function index() {
	$this->set('arr', array('<script>alert(0)</script>', 'hoge', array('fuga', array('hoge', 'fuga'))));
}
html
<!-- View/Smaple/index.ctp -->
 echo $xssstr; 
html
<!-- View/Smaple/index.ctp -->
 echo $arr[0];