Skip to content

Instantly share code, notes, and snippets.

@webspectyler
Last active December 13, 2015 21:49
Show Gist options
  • Save webspectyler/4980186 to your computer and use it in GitHub Desktop.
Save webspectyler/4980186 to your computer and use it in GitHub Desktop.
Use Yii Models in custom PHP code
<?php
/**** Initialize Yii */
require_once($_SERVER['DOCUMENT_ROOT'].'/path/to/yii/framework/yii.php');
Yii::createWebApplication($_SERVER['DOCUMENT_ROOT'] . '/path/to/config/main.php');
// ...
$product = Product::model()->findByPk(3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment