dousongxuan7507 2014-03-12 04:17
浏览 43
已采纳

映射PHP方法和函数的顺序 - 动态

I would like to visualize where data is passed, from its start point to its end point. Is there a way to use php log to create list of where data has been passed?

If NO - Maybe you can offer me some advice.

The code below is for an activity feed. Data posted is passed into one function - placed into an array, and passed to the function below. From there the data is transferred to this class and I would like to understand what happens to it from there.

function bp_activity_add( $args = '' ) {

$defaults = array(
    'id'                => false, // Pass an existing activity ID to update an existing entry.

    'action'            => '',    // The activity action - e.g. "Jon Doe posted an update"
    'content'           => '',    // Optional: The content of the activity item e.g. "BuddyPress is awesome guys!"

    'component'         => false, // The name/ID of the component e.g. groups, profile, mycomponent
    'type'              => false, // The activity type e.g. activity_update, profile_updated
    'primary_link'      => '',    // Optional: The primary URL for this item in RSS feeds (defaults to activity permalink)

    'user_id'           => bp_loggedin_user_id(), // Optional: The user to record the activity for, can be false if this activity is not for a user.
    'item_id'           => false, // Optional: The ID of the specific item being recorded, e.g. a blog_id
    'secondary_item_id' => false, // Optional: A second ID used to further filter e.g. a comment_id
    'recorded_time'     => bp_core_current_time(), // The GMT time that this activity was recorded
    'hide_sitewide'     => false, // Should this be hidden on the sitewide activity stream?
    'is_spam'           => false, // Is this activity item to be marked as spam?
);
$params = wp_parse_args( $args, $defaults );
extract( $params, EXTR_SKIP );

// Make sure we are backwards compatible
if ( empty( $component ) && !empty( $component_name ) )
    $component = $component_name;

if ( empty( $type ) && !empty( $component_action ) )
    $type = $component_action;

// Setup activity to be added
$activity                    = new BP_Activity_Activity( $id );
$activity->user_id           = $user_id;
$activity->component         = $component;
$activity->type              = $type;
$activity->action            = $action;
$activity->content           = $content;
$activity->primary_link      = $primary_link;
$activity->item_id           = $item_id;
$activity->secondary_item_id = $secondary_item_id;
$activity->date_recorded     = $recorded_time;
$activity->hide_sitewide     = $hide_sitewide;
$activity->is_spam           = $is_spam;

if ( !$activity->save() )
    return false;

// If this is an activity comment, rebuild the tree
if ( 'activity_comment' == $activity->type )
    BP_Activity_Activity::rebuild_activity_comment_tree( $activity->item_id );

wp_cache_delete( 'bp_activity_sitewide_front', 'bp' );
do_action( 'bp_activity_add', $params );

return $activity->id;
}
  • 写回答

1条回答 默认 最新

  • dongyi3776 2014-03-12 04:26
    关注

    You can use Xdebug stack trace but isn't going to get you the path of the variable but where the script has gone to get to that point. http://xdebug.org/docs/stack_trace

    If you have Xdebug installed with a IDE like eclipse, you can walk through the script. http://devzone.zend.com/1147/debugging-php-applications-with-xdebug/

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥15 Python3.5 相关代码写作
  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗