使用r将html文件保存到mysql中,并使用php显示该文件

66bbxpm5  于 2021-06-21  发布在  Mysql
关注(0)|答案(0)|浏览(177)

下面的代码是由r语言函数编写的:将html文件保存到数据库中

  1. html_binary <- paste(readBin("EventChart3.html", what="raw", n=1e6),
  2. collapse='')
  3. sql<-paste0("INSERT INTO test (`att`) VALUES ('",html_binary,"')")
  4. dbSendQuery(connect,sql)

下面的代码是用php语言编写的函数:show the html file

  1. $sql=sprintf("select * from test where id=37");
  2. $result=mysql_query($sql);
  3. $row=mysql_fetch_assoc($result) ;
  4. print $row['id']."</br>";
  5. header("content-type:text/html");
  6. echo $row['att'];

表只有两个属性1。id:自动递增,int 2。附件:保存二进制文件,blob
我的php显示了很多二进制代码,我不知道如何解决它。请给我帮助,谢谢大家

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题