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 模电中二极管,三极管和电容的应用
  • ¥15 关于模型导入UNITY的.FBX: Check external application preferences.警告。
  • ¥15 气象网格数据与卫星轨道数据如何匹配
  • ¥100 java ee ssm项目 悬赏,感兴趣直接联系我
  • ¥15 微软账户问题不小心注销了好像
  • ¥15 x264库中预测模式字IPM、运动向量差MVD、量化后的DCT系数的位置
  • ¥15 curl 命令调用正常,程序调用报 java.net.ConnectException: connection refused
  • ¥20 关于web前端如何播放二次加密m3u8视频的问题
  • ¥15 使用百度地图api 位置函数报错?
  • ¥15 metamask如何添加TRON自定义网络