Home  >  Article  >  Backend Development  >  PHP能不能实现按原来的各式读取某个文件的内容?该怎么处理

PHP能不能实现按原来的各式读取某个文件的内容?该怎么处理

WBOY
WBOYOriginal
2016-06-13 13:37:37875browse

PHP能不能实现按原来的各式读取某个文件的内容?
代码如下:

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
$current = file_get_contents("http://xxxxx/xxxxx/get_people_count.php");


get_people_count.php代码如下:
PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
<?php error_reporting(E_ALL^E_NOTICE);
  date_default_timezone_set("PRC");
  require_once("FlowfairyDB.php");
  $flowcon=new FlowfairyDB();
  echo $flowcon->GetCount();
?>


$flowcon->GetCount()的返回值是int类型的,可是读取过来就变成string类型的了。我需要不断地读取$flowcon->GetCount()的返回值并把它们按照int类型存入数据表以方便比较大小,该怎样做?

------解决方案--------------------
php是弱类型语言,他会根据上下文自动变换数据类型
只要你的表字段是int类型的就可以了
------解决方案--------------------
用intval函数
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn