drbvm26000 2016-02-16 12:22
浏览 576
已采纳

PHP警告:strpos()期望参数1为字符串,给定数组

In this question, I see where the $handle = @fopen($thumb, 'r'); was changed to $handle = @file_get_contents($thumb); because he needed to use file_get_contents for a string.

I am getting the same error but I do not see a fopen() element that needs to be changed? Where does this need to occur?

} elseif( strpos($post_id, 'user_') !== false ) {

    $user_id = str_replace('user_', '', $post_id);
    $user_id = intval( $user_id );

    $v = get_user_meta( $user_id, $field['name'], false );

    // value is an array
    if( isset($v[0]) ) {

        $value = $v[0];

    }
  • 写回答

2条回答 默认 最新

  • dtzk85937 2016-02-16 12:27
    关注

    From the error $post_id is an array. An example of strpos

    $mystring = 'abc';
    $findme   = 'a';
    $pos = strpos($mystring, $findme);
    

    In your code print_r($post_id) to see containing values

     strpos($post_id, 'user_')//here $post_id is array
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分