当前位置: 首页>>代码示例>>PHP>>正文


PHP Subject::to_array方法代码示例

本文整理汇总了PHP中Subject::to_array方法的典型用法代码示例。如果您正苦于以下问题:PHP Subject::to_array方法的具体用法?PHP Subject::to_array怎么用?PHP Subject::to_array使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Subject的用法示例。


在下文中一共展示了Subject::to_array方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: trim

if (!isset($APP)) {
    die;
}
$default_controller = $APP['controller_path'] . '/news_controller.php';
$constraint = NULL;
$id = NULL;
if (isset($_GET['constraint'])) {
    $constraint = trim($_GET['constraint']);
}
if (isset($_GET['id'])) {
    $id = (int) trim($_GET['id']);
}
$post_data = 'action: "view_subject"';
$news_feeds = new Subject();
$news_feeds->load_from_name('News Feeds');
$feeds_object_array = $news_feeds->to_array();
$feeds_string = '';
foreach ($feeds_object_array['aspects'] as $x) {
    $feeds_string .= '"' . $x['aspect_data'] . '",';
}
$feeds_string = rtrim($feeds_string, ",");
?>

<div class="col-xs-12" id="main_view">
	<h3>Today's News</h3>
	<div id="feed_display" class="feed_stage" style="padding: 0px;"></div>

</div>
<script type="text/javascript">
  
   $(function() {   
开发者ID:imonroe,项目名称:coldreader,代码行数:31,代码来源:news_view.php

示例2: trim

 * @since      File included in initial release
 *
 */
// bootstrap the rest of the codebase.
require_once '../config.php';
csfr_protection();
$db = Database::get_instance();
$action = NULL;
if (isset($_POST['action'])) {
    $action = trim($_POST['action']);
}
if (isset($action)) {
    switch ($action) {
        case "view_dash":
            break;
        case "inspire_me":
            $sayings = new Subject();
            $sayings->load_from_name('Inspirations');
            $sayings_array = $sayings->to_array();
            $output = $sayings_array['aspects'][array_rand($sayings_array['aspects'])]['aspect_data'];
            // print_r($inspirational_sayings);
            echo $output;
            break;
        default:
            new LogEntry(__FILE__ . " was hit with an invalid action, from IP: " . $_SERVER['REMOTE_ADDR']);
            echo 'There was an error.  It has been logged.';
    }
} else {
    new LogEntry(__FILE__ . " was hit with no action, from IP: " . $_SERVER['REMOTE_ADDR']);
    echo 'There was an error.  It has been logged.';
}
开发者ID:imonroe,项目名称:coldreader,代码行数:31,代码来源:dash_controller.php


注:本文中的Subject::to_array方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。