Advertisement
Guest User

Untitled

a guest
Dec 10th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. class GetcontrollerController extends Controller{
  2. public $json;
  3.  
  4. public function beforeAction( $event )
  5. {
  6. $this->enableCsrfValidation = false;
  7. $this->json = Json::decode(file_get_contents("php://input"), false);
  8. header('content-type: text/javascript');
  9. return parent::beforeAction( $event );
  10. }
  11.  
  12. public function actions()
  13. {
  14. return [
  15. 'error' => [
  16. 'class' => 'yiiwebErrorAction',
  17. ]
  18. ];
  19. }
  20. public function actionIndex(){
  21.  
  22. $file = $this->json->file;
  23.  
  24. $handle = fopen( Yii::getAlias( "@webroot" ) . '\js2\controllers\' . $file . ".js", "r" );
  25. while( $line = fgets( $handle ) ){
  26. echo $line;
  27. }
  28.  
  29. global $urlpath;
  30.  
  31. echo "n//# sourceURL=" . $urlpath . "js2/" . $file . ".js";
  32. }
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement