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

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

WBOY
WBOYasal
2016-06-13 13:37:37875semak imbas

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函数
Kenyataan:
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Artikel sebelumnya: 请问php怎么开发多语言网站 Artikel seterusnya: PHP搜索写法 请